A segmented control is useful for a short list of mutually exclusive views such as “Grid” and “List.” Keep the selected value in React state and derive the rendered view from it.
Define the options once
import { useState } from 'react';
import { LiquidSegmented } from 'quick-liquid/react';
const options = [
{ value: 'grid', label: 'Grid' },
{ value: 'list', label: 'List' },
] as const;
export function LibraryLayout() {
const [layout, setLayout] = useState<'grid' | 'list'>('grid');
return (
<section>
<LiquidSegmented
options={options}
value={layout}
onChange={setLayout}
ariaLabel="Library layout"
spring="snappy"
/>
<div className={layout === 'grid' ? 'library-grid' : 'library-list'}>
<article>Saved for later</article>
<article>Recently opened</article>
</div>
</section>
);
}
The default group behavior fits this local view preference. The ariaLabel describes the decision the user is making. With a true tabbed interface, provide the matching panel semantics and verify the keyboard behavior for your complete interface.
Tune the movement after setting labels
Use orientation="vertical" when the options sit in a column. Use glass={false} to keep the spring while removing the refractive indicator treatment. The same value and onChange contract continues to control the selection. Try updating the value from elsewhere in the app and confirm that the indicator moves to the same option the content reflects.
For navigation between pages, use anchors and attach an indicator to the links. That keeps link actions such as opening in a new tab available.