折りたたみ
折りたたんだり展開したりできるコンテンツエリア。
いつ使用するか
- ページをきれいに保つために複雑な領域をグループ化または非表示にするために使用できます。
- アコーディオンは特別な種類の折りたたみで、一度に1つのパネルのみを展開できます。
折りたたみ
同時に複数のパネルを展開できます。
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
astro
<Accordion>
<AccordionItem title="This is panel header 1">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
<AccordionItem title="This is panel header 2">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
<AccordionItem title="This is panel header 3">
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
</AccordionItem>
</Accordion> アコーディオン
アコーディオンモード、一度に展開できるパネルは1つだけです。
This is panel header 1 content
This is panel header 2 content
This is panel header 3 content
astro
<Accordion type="single">
<AccordionItem title="This is panel header 1" isOpen>
This is panel header 1 content
</AccordionItem>
<AccordionItem title="This is panel header 2">
This is panel header 2 content
</AccordionItem>
<AccordionItem title="This is panel header 3">
This is panel header 3 content
</AccordionItem>
</Accordion> 追加ノード / アイコン
`icon` と `expandIcon` プロパティを使用してアイコンをカスタマイズできます。
Manage your account settings and preferences.
View and update your payment methods and billing history.
Configure how you receive alerts and updates.
astro
<Accordion>
<AccordionItem title="Account Settings" icon="User">
Manage your account settings and preferences.
</AccordionItem>
<AccordionItem title="Billing Information" icon="CreditCard">
View and update your payment methods and billing history.
</AccordionItem>
<AccordionItem title="Notifications" icon="Bell">
Configure how you receive alerts and updates.
</AccordionItem>
</Accordion> カスタムパネルヘッダー
`title`スロットを使用して、各パネルのヘッダースタイルをカスタマイズします。
This item uses a custom slot for the title to allow complex layouts.
astro
<Accordion>
<AccordionItem>
<div slot="title" class="flex items-center justify-between w-full pr-4 text-left">
<span class="font-semibold text-blue-600 dark:text-blue-400">Custom Styled Title</span>
<span class="text-xs px-2 py-1 bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300 rounded-full">New</span>
</div>
This item uses a custom slot for the title to allow complex layouts.
</AccordionItem>
</Accordion> API
Accordion
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| type | 同時に展開されるアイテムを"single"または"multiple"のいずれかに許可する動作を設定します。 | "single" | "multiple" | "multiple" |
| class | アコーディオンコンテナに適用する追加のCSSクラス。 | string | '' |
AccordionItem
| プロパティ | 説明 | タイプ | デフォルト |
|---|---|---|---|
| title | アコーディオンアイテムのテキストタイトル。 | string | '' |
| isOpen | アイテムがデフォルトで開いているかどうか。 | boolean | false |
| icon | タイトルの左側に表示するアイコン。 | IconName | '' |
| expandIcon | 展開トリガーのために右側に表示するアイコン。 | IconName | "ChevronDown" |
| class | アイテムの追加のCSSクラス。 | string | '' |