Skip to content

Commit

Permalink
docs: update select examples (#2562)
Browse files Browse the repository at this point in the history
* docs: update select examples

* chore: update examples
  • Loading branch information
Lelith authored Aug 24, 2023
1 parent 6daf49b commit d175f54
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/components/forms/examples/SelectSizes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { Select, SectionHeading, Stack } from '@contentful/f36-components';

export default function SelectSizes() {
return (
<Stack>
<SectionHeading>Size Medium</SectionHeading>
<Select
id="optionSelect-medium"
name="optionSelect-medium"
defaultValue="optionTwo"
>
<Select.Option value="optionOne">Option 1</Select.Option>
<Select.Option value="optionTwo">Option 2</Select.Option>
<Select.Option value="optionThree" isDisabled>
Disabled option
</Select.Option>
</Select>
<SectionHeading>Size Small</SectionHeading>
<Select
id="optionSelect-small"
name="optionSelect-small"
size="small"
defaultValue="optionTwo"
>
<Select.Option value="optionOne">Option 1</Select.Option>
<Select.Option value="optionTwo">Option 2</Select.Option>
<Select.Option value="optionThree" isDisabled>
Disabled option
</Select.Option>
</Select>
</Stack>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default function SelectWithLabelExample() {
<Select.Option value="optionOne">Option 1</Select.Option>
<Select.Option value="optionTwo">Long Option 2</Select.Option>
</Select>
<FormControl.HelpText>Select one of the options</FormControl.HelpText>
</FormControl>
);
}
6 changes: 6 additions & 0 deletions packages/components/forms/src/Select/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ There might be cases where you would need to include the help text or validation

```

### Select available sizes

```tsx file=../../examples/SelectSizes.tsx

```

### Select disabled state

```tsx file=../../examples/SelectDisabledExample.tsx
Expand Down

1 comment on commit d175f54

@vercel
Copy link

@vercel vercel bot commented on d175f54 Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.