title | components |
---|---|
Accordion React component |
Accordion, AccordionActions, AccordionDetails, AccordionSummary |
Expansion panels(拡張パネル) には作成フローが含まれ、要素を簡単に編集できます。
拡張パネルは 独立した軽量のコンテナであるか、カードなどの大きなサーフェスに接続されています。
注: 拡張パネルについては、Material Design guidelinesでは説明されていませんが、Material-UIでは引き続きサポートされます。 It was formerly known as the "expansion panel".
{{"demo": "pages/components/accordion/SimpleAccordion.js", "bg": true}}
パネルのデフォルトの動作を拡張し、Accordion
コンポーネントを使用してアコーディオンを作成します。
{{"demo": "pages/components/accordion/ControlledAccordions.js", "bg": true}}
コンポーネントのカスタマイズ例を次に示します。 詳細については、 オーバーライドのドキュメントページを参照してください。
{{"demo": "pages/components/accordion/CustomizedAccordions.js"}}
In order to put an action such as a Checkbox
or a button inside of the AccordionSummary
, you need to stop the propagation of the focus and click events to prevent the panel from expanding/collapsing when using the action. You should also provide an aria-label
for the action, otherwise the label of the nested action will be included in the label of the parent button that controls the accordion expansion.
{{"demo": "pages/components/accordion/ActionsInAccordionSummary.js", "bg": true}}
The content of Accordions is mounted by default even if the accordion is not expanded. このデフォルトの動作では、サーバー側のレンダリングとSEOが考慮されています。 Accordionsのコンテンツは、パネルが展開されていない場合でもデフォルトでマウントされます。 このデフォルトの動作では、サーバー側のレンダリングとSEOが考慮されています。 If you render expensive component trees inside your panels or simply render many panels it might be a good idea to change this default behavior by enabling the unmountOnExit
in TransitionProps
:
<Accordion TransitionProps={{ unmountOnExit: true }} />
他のパフォーマンス最適化と同様、これは特効薬ではありません。 まずボトルネックを特定してから、これらの最適化戦略を試してください。
複数の列を使用してコンテンツを構成でき、ユーザーを支援するためにヘルパーテキストをパネルに追加できます。
{{"demo": "pages/components/accordion/DetailedAccordion.js", "bg": true}}
(WAI-ARIA: https://www.w3.org/TR/wai-aria-practices/#accordion)
最適なアクセシビリティのために、 AccordionSummary``id
と aria-controls
を設定することをお勧めします。 Accordion
は、パネルのコンテンツ領域に必要な aria-labelledby
および id
を導き出します。 最適なアクセシビリティのために、 AccordionSummary``id
と aria-controls
を設定することをお勧めします。 Accordion
は、パネルのコンテンツ領域に必要な aria-labelledby
および id
を導き出します。