Accordion
コンテンツを表示・非表示にする縦に並んだセクション。一度に一つまたは複数を開け、WAI-ARIA の Accordion パターンに従います。
Angular: 対応 Vue: 対応 React: 対応 React Native: 対応
使い方
<sone-accordion collapsible [(value)]="open" style="max-width: 32rem">
<sone-accordion-item value="shipping">
<sone-accordion-trigger>What are your shipping options?</sone-accordion-trigger>
<sone-accordion-content>
Standard delivery takes 3–5 working days; express arrives the next day.
</sone-accordion-content>
</sone-accordion-item>
<sone-accordion-item value="returns">
<sone-accordion-trigger>What is your return policy?</sone-accordion-trigger>
<sone-accordion-content>
Return any unused item within 30 days for a full refund.
</sone-accordion-content>
</sone-accordion-item>
<sone-accordion-item value="billing" disabled>
<sone-accordion-trigger>Can I change my billing plan?</sone-accordion-trigger>
<sone-accordion-content>Only workspace owners can change the plan.</sone-accordion-content>
</sone-accordion-item>
</sone-accordion>インポート
import {
SoneAccordionContentDirective,
SoneAccordionDirective,
SoneAccordionIconDirective,
SoneAccordionItemDirective,
SoneAccordionTriggerComponent,
} from "@surface-one/angular/accordion";API リファレンス
SoneAccordionContentDirectiveディレクティブ
`[soneAccordionContent]` / `<sone-accordion-content>` — the region the trigger shows.
SoneAccordionDirectiveディレクティブ
`[soneAccordion]` / `<sone-accordion>` — a stack of headed sections that show and hide their content (WAI-ARIA Accordion). `type` single or multiple, `collapsible` (single), two-way `[(value)]` with the open item values. Up / Down, Home and End move between the triggers.
| 名前 | 型 | デフォルト |
|---|---|---|
type`single`: one item open at a time; `multiple`: any number. | AccordionType | "single" |
collapsibleA `single` accordion lets its open item close again. | boolean | false |
disabledDisables every item. | boolean | false |
value双方向The open item values: a value (or `null`) when `single`, a list when `multiple`. | AccordionValue | null |
SoneAccordionIconDirectiveディレクティブ
`[soneAccordionIcon]` — your own icon in place of the chevron; it turns when open.
SoneAccordionItemDirectiveディレクティブ
`[soneAccordionItem]` / `<sone-accordion-item>` — one section: a trigger and its content.
| 名前 | 型 | デフォルト |
|---|---|---|
valueNames the item in the accordion's `value`; unique by default. | string | this.uid |
disabled | boolean | false |
SoneAccordionTriggerComponentコンポーネント
`<sone-accordion-trigger>` — the item's heading (`role="heading"`, `level`) with the button that opens and closes it. Project an `[soneAccordionIcon]` to replace the chevron.
| 名前 | 型 | デフォルト |
|---|---|---|
levelThe heading level of the trigger (`aria-level`). | number | 3 |