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

docs: update select examples #2562

Merged
merged 4 commits into from
Aug 24, 2023
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
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
Loading