About
Individual segment item rendering as a radio button within the segmented control. Astryx by Meta. Source: https://astryx.atmeta.com/components/SegmentedControlItem
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Segmented Control Item to your project and fits it to your theme.
Code
How Astryx Segmented Control Item is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
'use client';
/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-segmented-control-item.tsx. */
import '@/components/ui/astryx-segmented-control-item-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
import {useState} from 'react';
import {
SegmentedControl,
SegmentedControlItem,
} from '@/components/ui/astryx-segmented-control-item';
import {Center} from '@astryxdesign/core/Center';
import {Icon} from '@astryxdesign/core/Icon';
function OfficialSample() {
const [view, setView] = useState('board');
return (
<Center>
<SegmentedControl value={view} onChange={setView} label="View mode">
<SegmentedControlItem
value="board"
label="Board"
icon={<Icon icon="viewColumns" />}
/>
<SegmentedControlItem
value="list"
label="List"
icon={<Icon icon="menu" />}
/>
<SegmentedControlItem
value="timeline"
label="Timeline"
icon={<Icon icon="calendar" />}
/>
<SegmentedControlItem
value="chart"
label="Chart"
icon={<Icon icon="arrowsUpDown" />}
isDisabled
/>
</SegmentedControl>
</Center>
);
}
function readPreviewMode() {
const {classList} = document.documentElement;
return classList.contains('dark') ? 'dark' : 'light';
}
function subscribeToPreviewMode(callback: () => void) {
const observer = new MutationObserver(callback);
observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
return () => observer.disconnect();
}
export default function Demo() {
const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
return (
<Theme theme={neutralTheme} mode={mode}>
<div className="astryx-demo">
<div className="astryx-demo-content" data-centered style={{maxWidth: 350}}>
<OfficialSample />
</div>
</div>
</Theme>
);
}















