-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): adds input element, ref #4810
- Loading branch information
1 parent
a6e116c
commit e223b0a
Showing
11 changed files
with
545 additions
and
206 deletions.
There are no files selected for viewing
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Input } from './input'; | ||
|
||
const meta: Meta<typeof Input.Root> = { | ||
component: Input.Root, | ||
tags: ['autodocs'], | ||
title: 'Input', | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Input.Root>; | ||
|
||
export const Default: Story = { | ||
render: () => ( | ||
<Input.Root> | ||
<Input.Label>Label</Input.Label> | ||
<Input.Field type="text" /> | ||
</Input.Root> | ||
), | ||
}; | ||
|
||
export const Error: Story = { | ||
render: () => ( | ||
<Input.Root data-has-error="true"> | ||
<Input.Label>Error field</Input.Label> | ||
<Input.Field type="text" /> | ||
</Input.Root> | ||
), | ||
}; | ||
|
||
export const DefaultValue: Story = { | ||
render: () => ( | ||
<Input.Root> | ||
<Input.Label>Description</Input.Label> | ||
<Input.Field value="This is a default value" type="text" /> | ||
</Input.Root> | ||
), | ||
}; | ||
|
||
/** | ||
* When using a placeholder, the label *must* come after the `Input.Field`. | ||
*/ | ||
export const WithPlaceholder: Story = { | ||
render: () => ( | ||
<Input.Root> | ||
<Input.Field placeholder="Demo placeholder" type="text" /> | ||
<Input.Label>Error field</Input.Label> | ||
</Input.Root> | ||
), | ||
}; |
Oops, something went wrong.