アクションシートは、ユーザーに特定のタスクの処理方法に関する選択肢を提供するためのスライドアップパネルです。
アクションシートを使用して、潜在的に危険なアクションの確認を求めることもできます。
アクションシートには、オプションのタイトルと1つ以上のボタンが含まれており、各ボタンは実行するアクションに対応しています。
以下のコンポーネントが含まれています。
ActionsActionsButtonActionsLabelActionsGroup| 名前 | 型 | デフォルト値 | 説明 |
|---|---|---|---|
| backdrop | boolean | true | アクションシートのバックドロップ(背景の暗い半透明レイヤー)を有効にします。 |
| opened | boolean | false | アクションシートを開閉し、初期状態を設定できます。 |
| onBackdropClick | function(e) | バックドロップ要素のクリックハンドラー |
| 名前 | 型 | デフォルト値 | 説明 |
|---|---|---|---|
| bold | boolean | undefined | ボタンテキストを太字にします。 |
| boldIos | boolean | false | iOSテーマでボタンテキストを太字にします。 |
| boldMaterial | boolean | false | Materialテーマでボタンテキストを太字にします。 |
| colors | object | Tailwind CSS カラークラスを含むオブジェクト | |
| colors.activeBgIos | string | 'active:bg-neutral-200 dark:active:bg-neutral-700' | |
| colors.activeBgMaterial | string | '' | |
| colors.bgIos | string | 'bg-white dark:bg-neutral-800' | |
| colors.bgMaterial | string | 'bg-md-light-surface-3 dark:bg-md-dark-surface-3' | |
| colors.textIos | string | 'text-primary' | |
| colors.textMaterial | string | 'text-md-light-on-surface dark:text-md-dark-on-surface' | |
| dividers | boolean | undefined | ボタンの外側のヘアライン(ボーダー)を表示します。指定されていない場合、iOSテーマで有効になります。 |
| fontSizeIos | string | 'text-xl' | iOSテーマでのボタンテキストのフォントサイズ |
| fontSizeMaterial | string | 'text-base' | Materialテーマでのボタンテキストのフォントサイズ |
| href | string | リンクの`href`属性。指定すると、`<a>`要素としてもレンダリングされます。 | |
| touchRipple | boolean | true | Materialテーマでタッチリップル効果を有効にします。 |
| onClick | function(e) | `click`イベントハンドラー |
| 名前 | 型 | デフォルト値 | 説明 |
|---|---|---|---|
| colors | object | Tailwind CSS カラークラスを含むオブジェクト | |
| colors.bgIos | string | 'bg-white dark:bg-neutral-800' | |
| colors.bgMaterial | string | 'bg-md-light-surface-3 dark:bg-md-dark-surface-3' | |
| colors.textIos | string | 'text-black text-opacity-55 dark:text-white dark:text-opacity-55' | |
| colors.textMaterial | string | 'text-md-light-primary dark:text-md-dark-primary' | |
| dividers | boolean | undefined | ボタンの外側のヘアライン(ボーダー)を表示します。指定されていない場合、iOSテーマで有効になります。 |
| fontSizeIos | string | 'text-sm' | iOSテーマでのボタンテキストのフォントサイズ |
| fontSizeMaterial | string | 'text-sm' | Materialテーマでのボタンテキストのフォントサイズ |
| 名前 | 型 | デフォルト値 | 説明 |
|---|---|---|---|
| dividers | boolean | true | グループの外側のヘアライン(ボーダー)を表示します。(Materialテーマのみ) |
<script>import {Page,Navbar,NavbarBackLink,BlockTitle,Block,Button,Actions,ActionsButton,ActionsLabel,ActionsGroup,} from 'konsta/svelte';let actionsOneOpened = false;let actionsTwoOpened = false;</script><Page><Navbar title="Action Sheet" /><Block strong inset class="space-y-4"><p>Action Sheet is a slide-up pane for presenting the user with a set ofalternatives for how to proceed with a given task.</p></Block><BlockTitle>Open Action Sheet</BlockTitle><Block strong inset class="flex space-x-4 rtl:space-x-reverse"><Button onClick={() => (actionsOneOpened = true)}>One group</Button><Button onClick={() => (actionsTwoOpened = true)}>Two groups</Button></Block><Actionsopened={actionsOneOpened}onBackdropClick={() => (actionsOneOpened = false)}><ActionsGroup><ActionsLabel>Do something</ActionsLabel><ActionsButton onClick={() => (actionsOneOpened = false)} bold>Button 1</ActionsButton><ActionsButton onClick={() => (actionsOneOpened = false)}>Button 2</ActionsButton><ActionsButton onClick={() => (actionsOneOpened = false)}>Cancel</ActionsButton></ActionsGroup></Actions><Actionsopened={actionsTwoOpened}onBackdropClick={() => (actionsTwoOpened = false)}><ActionsGroup><ActionsLabel>Do something</ActionsLabel><ActionsButton onClick={() => (actionsTwoOpened = false)} bold>Button 1</ActionsButton><ActionsButton onClick={() => (actionsTwoOpened = false)}>Button 2</ActionsButton></ActionsGroup><ActionsGroup><ActionsButton onClick={() => (actionsTwoOpened = false)}>Cancel</ActionsButton></ActionsGroup></Actions></Page>