🔥 新プロジェクトのご紹介 t0ggles -究極のプロジェクト管理ツール! 🔥

アクションシート Svelte コンポーネント

アクションシートは、ユーザーに特定のタスクの処理方法に関する選択肢を提供するためのスライドアップパネルです。

アクションシートを使用して、潜在的に危険なアクションの確認を求めることもできます。

アクションシートには、オプションのタイトルと1つ以上のボタンが含まれており、各ボタンは実行するアクションに対応しています。

アクションシートコンポーネント

以下のコンポーネントが含まれています。

  • Actions
  • ActionsButton
  • ActionsLabel
  • ActionsGroup

Actions プロパティ

名前デフォルト値説明
backdropbooleantrue

アクションシートのバックドロップ(背景の暗い半透明レイヤー)を有効にします。

openedbooleanfalse

アクションシートを開閉し、初期状態を設定できます。

onBackdropClickfunction(e)

バックドロップ要素のクリックハンドラー

ActionsButton プロパティ

名前デフォルト値説明
boldbooleanundefined

ボタンテキストを太字にします。boldIosboldMaterial を上書きします。

boldIosbooleanfalse

iOSテーマでボタンテキストを太字にします。

boldMaterialbooleanfalse

Materialテーマでボタンテキストを太字にします。

colorsobject

Tailwind CSS カラークラスを含むオブジェクト

colors.activeBgIosstring'active:bg-neutral-200 dark:active:bg-neutral-700'
colors.activeBgMaterialstring''
colors.bgIosstring'bg-white dark:bg-neutral-800'
colors.bgMaterialstring'bg-md-light-surface-3 dark:bg-md-dark-surface-3'
colors.textIosstring'text-primary'
colors.textMaterialstring'text-md-light-on-surface dark:text-md-dark-on-surface'
dividersbooleanundefined

ボタンの外側のヘアライン(ボーダー)を表示します。指定されていない場合、iOSテーマで有効になります。

fontSizeIosstring'text-xl'

iOSテーマでのボタンテキストのフォントサイズ

fontSizeMaterialstring'text-base'

Materialテーマでのボタンテキストのフォントサイズ

hrefstring

リンクの`href`属性。指定すると、`<a>`要素としてもレンダリングされます。

touchRipplebooleantrue

Materialテーマでタッチリップル効果を有効にします。

onClickfunction(e)

`click`イベントハンドラー

ActionsLabel プロパティ

名前デフォルト値説明
colorsobject

Tailwind CSS カラークラスを含むオブジェクト

colors.bgIosstring'bg-white dark:bg-neutral-800'
colors.bgMaterialstring'bg-md-light-surface-3 dark:bg-md-dark-surface-3'
colors.textIosstring'text-black text-opacity-55 dark:text-white dark:text-opacity-55'
colors.textMaterialstring'text-md-light-primary dark:text-md-dark-primary'
dividersbooleanundefined

ボタンの外側のヘアライン(ボーダー)を表示します。指定されていない場合、iOSテーマで有効になります。

fontSizeIosstring'text-sm'

iOSテーマでのボタンテキストのフォントサイズ

fontSizeMaterialstring'text-sm'

Materialテーマでのボタンテキストのフォントサイズ

ActionsGroup プロパティ

名前デフォルト値説明
dividersbooleantrue

グループの外側のヘアライン(ボーダー)を表示します。(Materialテーマのみ)

ActionSheet.svelte
<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 of
alternatives 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>
<Actions
opened={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>
<Actions
opened={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>
コードライセンス MIT.
2022 © Konsta UI by nolimits4web.