I start with UI Fabric react; I am developing a FAQ; I use for that a list; but the result is not good; I want to do something looks like an accordion, where we can see the question as a header and when we click on it or a checker the cheveron; answer is displayed, but don't know how to do that with UI fabric, here is my code
public render(): JSX.Element {
const { faqList: originalItems } = this.props;
const { items = [] } = this.state;
const resultCountText = items.length === originalItems.length ? '' : ` (${items.length} of ${originalItems.length} shown)`;
const { selectedItem } = this.state;
return (
<div >
<Label>FAQ </Label>
<FocusZone direction={FocusZoneDirection.vertical}>
<Dropdown
label="Categories"
selectedKey={selectedItem ? selectedItem.key : undefined}
onChange={this._onChange}
placeholder="Selectionnez une catégorie"
options={this.state.categorieOption}
styles={{ dropdown: { width: 300 } }}
/>
<TextField label={'Filtre par question' + resultCountText} onChange={this._onFilterChanged} />
<List items={items} onRenderCell={this._onRenderCell} />
</FocusZone>
</div>
);
}
private _onRenderCell(item: IExampleItem, index: number | undefined): JSX.Element {
return (
<div className={classNames.itemCell} data-is-focusable={true}>
<div className={classNames.itemContent}>
<div className={classNames.itemQuestion}>{item.Question}</div>
<div className={classNames.itemReponse}>{item.Reponse}</div>
<div className={classNames.itemIndex}>{`Langue : ${item.Langue.Nom}`}</div>
</div>
</div>
);
}