Skip to content

Commit 506903e

Browse files
authored
docs(storybook): Render Label examples within a usa-form for USWDS intended styling (#3518)
1 parent 55eb035 commit 506903e

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/components/forms/Label/Label.stories.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22
import { Label } from './Label'
33
import type { Meta, StoryObj } from '@storybook/react-vite'
4+
import { Form } from '../Form/Form'
45

56
const meta = {
67
title: 'Components/Form elements/Label',
@@ -17,6 +18,11 @@ Source: https://designsystem.digital.gov/components/form-controls/
1718
},
1819
},
1920
args: { htmlFor: 'testInput', children: 'Text input' },
21+
render: (args) => (
22+
<Form onSubmit={() => {}}>
23+
<Label {...args} />
24+
</Form>
25+
),
2026
} satisfies Meta<typeof Label>
2127

2228
export default meta
@@ -35,11 +41,10 @@ export const Error: Story = {
3541
}
3642

3743
export const WithHint: Story = {
38-
render: (args) => (
39-
<Label {...args} htmlFor="testInputHint" hint={<> (optional)</>}>
40-
Text input
41-
</Label>
42-
),
44+
args: {
45+
htmlFor: 'testInputHint',
46+
hint: <> (optional)</>,
47+
},
4348
}
4449

4550
export const WithRequiredMarker: Story = {

0 commit comments

Comments
 (0)