Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/unlucky-ways-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Moves SegmentedControl to the main bundle and updates it's lifecycle status to "Alpha"
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
componentId: segmented_control
title: SegmentedControl
status: Draft
description: Use a segmented control to let users select an option from a short list and immediately apply the selection
status: Alpha
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The component lifecycle label doesn't appear to be updating. Is there something else I need to do to get this showing "Alpha" instead of "Drafts"?

Screen Shot 2022-08-15 at 11 56 22 AM

Copy link
Member

@siddharthkp siddharthkp Aug 15, 2022

Choose a reason for hiding this comment

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

This might be related to preview deployment build because I see your changes on my machine 🤔

Copy link
Member

@siddharthkp siddharthkp Aug 16, 2022

Choose a reason for hiding this comment

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

Deployment is fixed now, turns out it was my fault ✨ 🙃

---

## Examples

### Uncontrolled (default)

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view">
<SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>
<SegmentedControl.Button>Raw</SegmentedControl.Button>
Expand All @@ -18,7 +19,7 @@ description: Use a segmented control to let users select an option from a short

### Controlled

```javascript noinline live drafts
```javascript noinline live
const Controlled = () => {
const [selectedIndex, setSelectedIndex] = React.useState(0)

Expand All @@ -40,7 +41,7 @@ render(Controlled)

### With icons and labels

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view">
<SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>
Preview
Expand All @@ -52,7 +53,7 @@ render(Controlled)

### With icons only

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view">
<SegmentedControl.IconButton defaultSelected icon={EyeIcon} aria-label="Preview" />
<SegmentedControl.IconButton icon={FileCodeIcon} aria-label="Raw" />
Expand All @@ -62,7 +63,7 @@ render(Controlled)

### With labels hidden on smaller viewports

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view" variant={{narrow: 'hideLabels', regular: 'default'}}>
<SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>
Preview
Expand All @@ -74,7 +75,7 @@ render(Controlled)

### Convert to a dropdown on smaller viewports

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view" variant={{narrow: 'dropdown', regular: 'default'}}>
<SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>
Preview
Expand All @@ -86,7 +87,7 @@ render(Controlled)

### Fill width of parent

```jsx live drafts
```jsx live
<SegmentedControl fullWidth aria-label="File view">
<SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>
<SegmentedControl.Button>Raw</SegmentedControl.Button>
Expand All @@ -96,7 +97,7 @@ render(Controlled)

### With a label and caption on the left

```jsx live drafts
```jsx live
<Box display="flex">
<Box flexGrow={1}>
<Text fontSize={2} fontWeight="bold" id="scLabel-vert" display="block">
Expand All @@ -116,7 +117,7 @@ render(Controlled)

### With a label above and caption below

```jsx live drafts
```jsx live
<FormControl>
<FormControl.Label id="scLabel-horiz">File view</FormControl.Label>
<SegmentedControl aria-labelledby="scLabel-horiz" aria-describedby="scCaption-horiz">
Expand All @@ -130,7 +131,7 @@ render(Controlled)

### With something besides the first option selected

```jsx live drafts
```jsx live
<SegmentedControl aria-label="File view">
<SegmentedControl.Button>Preview</SegmentedControl.Button>
<SegmentedControl.Button defaultSelected>Raw</SegmentedControl.Button>
Expand Down Expand Up @@ -223,15 +224,15 @@ render(Controlled)
<ComponentChecklist
items={{
propsDocumented: true,
noUnnecessaryDeps: false,
adaptsToThemes: false,
adaptsToScreenSizes: false,
fullTestCoverage: false,
noUnnecessaryDeps: true,
adaptsToThemes: true,
adaptsToScreenSizes: true,
fullTestCoverage: true,
usedInProduction: false,
usageExamplesDocumented: false,
hasStorybookStories: false,
designReviewed: false,
a11yReviewed: false,
usageExamplesDocumented: true,
hasStorybookStories: true,
designReviewed: true,
a11yReviewed: true,
stableApi: false,
addressedApiFeedback: false,
hasDesignGuidelines: false,
Expand Down
2 changes: 2 additions & 0 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
url: /Radio
- title: RadioGroup
url: /RadioGroup
- title: SegmentedControl
url: /SegmentedControl
- title: Select
url: /Select
- title: SelectPanel
Expand Down
2 changes: 1 addition & 1 deletion src/drafts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
export * from '../NavList'
export * from '../Dialog/Dialog'
export * from '../SegmentedControl'
export * from '../SegmentedControl' // TODO: remove from drafts bundle in next major release
export * from '../SplitPageLayout'

export {default as InlineAutocomplete} from './InlineAutocomplete'
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export type {PortalProps} from './Portal'
export {default as ProgressBar} from './ProgressBar'
export type {ProgressBarProps} from './ProgressBar'
export {default as RadioGroup} from './RadioGroup'
export {SegmentedControl} from './SegmentedControl'
export {default as Select} from './Select'
export type {SelectProps} from './Select'
export {SelectPanel} from './SelectPanel'
Expand Down