Skip to content

Commit

Permalink
feat(dropdown): integration and documentation with form-field
Browse files Browse the repository at this point in the history
  • Loading branch information
andresin87 committed Jan 3, 2024
1 parent c4aed65 commit 9ea3a32
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion packages/components/dropdown/src/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { BookmarkFill } from '@spark-ui/icons/dist/icons/BookmarkFill'
import { Tag } from '@spark-ui/tag'
import { VisuallyHidden } from '@spark-ui/visually-hidden'
import { Meta, StoryFn } from '@storybook/react'
import { ComponentProps, useState } from 'react'
import React, { ComponentProps, useState } from 'react'

import { Dropdown } from '.'

Expand Down Expand Up @@ -494,6 +494,31 @@ export const FormFieldDisabled: StoryFn = _args => {
</div>
)
}

export const FormFieldRequired: StoryFn = _args => {
return (
<div className="pb-[300px]">
<FormField isRequired>
<FormField.Label>Book</FormField.Label>
<Dropdown>
<Dropdown.Trigger>
<Dropdown.Value placeholder="Pick a book" />
</Dropdown.Trigger>
<Dropdown.Popover>
<Dropdown.Items>
<Dropdown.Item value="book-1">To Kill a Mockingbird</Dropdown.Item>
<Dropdown.Item value="book-2">War and Peace</Dropdown.Item>
<Dropdown.Item value="book-3">The Idiot</Dropdown.Item>
<Dropdown.Item value="book-4">A Picture of Dorian Gray</Dropdown.Item>
<Dropdown.Item value="book-5">1984</Dropdown.Item>
<Dropdown.Item value="book-6">Pride and Prejudice</Dropdown.Item>
</Dropdown.Items>
</Dropdown.Popover>
</Dropdown>
</FormField>
</div>
)
}
export const FormFieldValidation: StoryFn = () => {
const [state, setState] = useState<undefined | 'success' | 'alert' | 'error'>('error')

Expand Down

0 comments on commit 9ea3a32

Please sign in to comment.