Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Optional and hint stories #1669

Merged
merged 4 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion storybook/src/components/Label/Label.docs.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{/* @license CC0-1.0 */}

import { Controls, Markdown, Meta, Primary } from "@storybook/blocks";
import { Canvas, Controls, Markdown, Meta, Primary } from "@storybook/blocks";
import * as LabelStories from "./Label.stories.tsx";
import README from "../../../../packages/css/src/components/label/README.md?raw";

Expand All @@ -11,3 +11,20 @@ import README from "../../../../packages/css/src/components/label/README.md?raw"
<Primary />

<Controls />

## Examples

### Optional

Use the `optional` prop to indicate that the user doesn’t need to fill in the field to submit the form.

<Canvas of={LabelStories.Optional} />

### With hint

Use the `hint` prop to either customize the text for the optional property or provide another type of remark.

Note: ensure the hint meets [language level B1](https://www.amsterdam.nl/schrijfwijzer/heldere-taal-basis-onze-huisstijl/).
For the same reason, the default hint text in Dutch is ‘niet verplicht’, not ‘optioneel’.

<Canvas of={LabelStories.WithHint} />
12 changes: 12 additions & 0 deletions storybook/src/components/Label/Label.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {}

export const Optional: Story = {
args: {
optional: true,
},
}

export const WithHint: Story = {
args: {
hint: 'not required',
},
}