# Segment Group
URL: https://ark-ui.com/docs/components/segment-group
Source: https://raw.githubusercontent.com/chakra-ui/ark/refs/heads/main/website/src/content/pages/components/segment-group.mdx
Organizes and navigates between sections in a view.
---
## Anatomy
To set up the segmented control correctly, you'll need to understand its anatomy and how we name its parts.
> Each part includes a `data-part` attribute to help identify them in the DOM.
## Examples
Learn how to use the `SegmentGroup` component in your project. Let's take a look at the most basic example:
**Example: basic**
#### React
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
#### Solid
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const Basic = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
#### Vue
```vue
{{ framework }}
```
#### Svelte
```svelte
{#each frameworks as framework}
{framework}
{/each}
```
### Initial Value
To set a default segment on initial render, use the `defaultValue` prop:
**Example: initial-value**
#### React
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
#### Solid
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const InitialValue = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
#### Vue
```vue
{{ framework }}
```
#### Svelte
```svelte
{#each frameworks as framework (framework)}
{framework}
{/each}
```
### Controlled Segment Group
To create a controlled SegmentGroup component, manage the current selected segment using the `value` prop and update it
when the `onValueChange` event handler is called:
**Example: controlled**
#### React
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
import { useState } from 'react'
export const Controlled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const [value, setValue] = useState('React')
return (
setValue(e.value)}>
{frameworks.map((framework) => (
{framework}
))}
)
}
```
#### Solid
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index, createSignal } from 'solid-js'
export const Controlled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const [value, setValue] = createSignal('React')
return (
setValue(e.value)}>
{(framework) => (
{framework()}
)}
)
}
```
#### Vue
```vue
{{ framework }}
```
#### Svelte
```svelte
{#each frameworks as framework}
{framework}
{/each}
```
### Disabled Segment
To disable a segment, simply pass the `disabled` prop to the `SegmentGroup.Item` component:
**Example: disabled**
#### React
```tsx
import { SegmentGroup } from '@ark-ui/react/segment-group'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{frameworks.map((framework) => (
{framework}
))}
)
}
```
#### Solid
```tsx
import { SegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const Disabled = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
return (
{(framework) => (
{framework()}
)}
)
}
```
#### Vue
```vue
{{ framework }}
```
#### Svelte
```svelte
{#each frameworks as framework}
{framework}
{/each}
```
### Using the Root Provider
The `RootProvider` component provides a context for the radio-group. It accepts the value of the `useRadio-group` hook.
You can leverage it to access the component state and methods from outside the radio-group.
**Example: root-provider**
#### React
```tsx
import { SegmentGroup, useSegmentGroup } from '@ark-ui/react/segment-group'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const segmentGroup = useSegmentGroup()
return (
<>
{frameworks.map((framework) => (
{framework}
))}
>
)
}
```
#### Solid
```tsx
import { SegmentGroup, useSegmentGroup } from '@ark-ui/solid/segment-group'
import { Index } from 'solid-js'
export const RootProvider = () => {
const frameworks = ['React', 'Solid', 'Svelte', 'Vue']
const segmentGroup = useSegmentGroup()
return (
<>
{(framework) => (
{framework()}
)}
>
)
}
```
#### Vue
```vue
{{ framework }}
```
#### Svelte
```svelte
{#each frameworks as framework}
{framework}
{/each}
```
> If you're using the `RootProvider` component, you don't need to use the `Root` component.
## API Reference
## Accessibility
Complies with the [Radio WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
### Keyboard Support