-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1e4f14
commit 0bc2261
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
packages/ui/src/components/checkbox/checkbox.stories.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script context="module" lang="ts"> | ||
import type { Meta } from '@storybook/svelte' | ||
import { Checkbox } from './index.js' | ||
export const meta = { | ||
title: 'Atom/Checkbox', | ||
component: Checkbox, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
checked: { | ||
control: 'boolean', | ||
defaultValue: false, | ||
}, | ||
label: { | ||
control: 'text', | ||
defaultValue: '', | ||
}, | ||
onClick: { | ||
action: 'onClick', | ||
}, | ||
}, | ||
} satisfies Meta<Checkbox> | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { Story, Template } from '@storybook/addon-svelte-csf' | ||
</script> | ||
|
||
<!--👇 We create a “template” of how args map to rendering --> | ||
|
||
<Template let:args> | ||
<Checkbox {...args} /> | ||
</Template> | ||
|
||
<!-- 👇 Each story then reuses that template --> | ||
<Story name="Unchecked" args="{{ checked: false, label: 'Accept Terms' }}" /> | ||
|
||
<Story name="Checked" args="{{ checked: true, label: 'Accept Terms' }}" /> | ||
|
||
<Story name="Unchecked Without Label" args="{{ checked: false }}" /> | ||
|
||
<Story name="Checked Without Label" args="{{ checked: true }}" /> | ||
|
||
<Story | ||
name="Disabled Checkbox" | ||
args="{{ checked: false, label: 'Disabled Checkbox', disabled: true }}" | ||
/> |