アクションシートは、特定のタスクをどのように進めるかについて、ユーザーに選択肢を提示するためのスライドアップペインです。
アクションシートを使用して、ユーザーに潜在的に危険なアクションの確認を求めることもできます。
アクションシートには、オプションのタイトルと1つ以上のボタンが含まれており、それぞれが実行するアクションに対応しています。
以下のコンポーネントが含まれています
Actions
ActionsButton
ActionsLabel
ActionsGroup
名前 | タイプ | デフォルト | 説明 |
---|---|---|---|
backdrop | boolean | true | アクションシートのバックドロップ(背後にある暗い半透明レイヤー)を有効にします |
component | string | 'div' | コンポーネントのHTML要素 |
opened | boolean | false | アクションシートを開閉し、初期状態を設定できます |
onBackdropClick | function(e) | バックドロップ要素のクリックハンドラー |
名前 | タイプ | デフォルト | 説明 |
---|---|---|---|
bold | boolean | undefined | ボタンのテキストを太字にします。 |
boldIos | boolean | false | iOSテーマでボタンのテキストを太字にします |
boldMaterial | boolean | false | マテリアルテーマでボタンのテキストを太字にします |
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' | |
component | string | 'button' | コンポーネントのHTML要素 |
dividers | boolean | undefined | ボタンの外側のヘアライン(境界線)をレンダリングします。指定しない場合、iOSテーマで有効になります |
fontSizeIos | string | 'text-xl' | iOSテーマのボタンテキストのフォントサイズ |
fontSizeMaterial | string | 'text-base' | マテリアルテーマのボタンテキストのフォントサイズ |
href | string | リンクの | |
touchRipple | boolean | true | マテリアルテーマでタッチリップル効果を有効にします |
名前 | タイプ | デフォルト | 説明 |
---|---|---|---|
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' | |
component | string | 'div' | コンポーネントのHTML要素 |
dividers | boolean | undefined | ボタンの外側のヘアライン(境界線)をレンダリングします。指定しない場合、iOSテーマで有効になります |
fontSizeIos | string | 'text-sm' | iOSテーマのボタンテキストのフォントサイズ |
fontSizeMaterial | string | 'text-sm' | マテリアルテーマのボタンテキストのフォントサイズ |
名前 | タイプ | デフォルト | 説明 |
---|---|---|---|
component | string | 'div' | コンポーネントのHTML要素 |
dividers | boolean | true | グループの外側のヘアライン(境界線)をレンダリングします。(マテリアルテーマのみ) |
import React, { useState } from 'react';import {Page,Navbar,NavbarBackLink,Button,Block,BlockTitle,Actions,ActionsGroup,ActionsLabel,ActionsButton,} from 'konsta/react';export default function ActionSheetPage() {const isPreview = document.location.href.includes('examplePreview');const [actionsOneOpened, setActionsOneOpened] = useState(false);const [actionsTwoOpened, setActionsTwoOpened] = useState(false);return (<Page><Navbartitle="Action Sheet"/><Block strong inset className="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 className="flex space-x-4 rtl:space-x-reverse"><Button onClick={() => setActionsOneOpened(true)}>One group</Button><Button onClick={() => setActionsTwoOpened(true)}>Two groups</Button></Block><Actionsopened={actionsOneOpened}onBackdropClick={() => setActionsOneOpened(false)}><ActionsGroup><ActionsLabel>Do something</ActionsLabel><ActionsButton onClick={() => setActionsOneOpened(false)} bold>Button 1</ActionsButton><ActionsButton onClick={() => setActionsOneOpened(false)}>Button 2</ActionsButton><ActionsButton onClick={() => setActionsOneOpened(false)}>Cancel</ActionsButton></ActionsGroup></Actions><Actionsopened={actionsTwoOpened}onBackdropClick={() => setActionsTwoOpened(false)}><ActionsGroup><ActionsLabel>Do something</ActionsLabel><ActionsButton onClick={() => setActionsTwoOpened(false)} bold>Button 1</ActionsButton><ActionsButton onClick={() => setActionsTwoOpened(false)}>Button 2</ActionsButton></ActionsGroup><ActionsGroup><ActionsButton onClick={() => setActionsTwoOpened(false)}>Cancel</ActionsButton></ActionsGroup></Actions></Page>);}