SegmentSwitcher
This source is documented by the existing examples linked below.
src/components/SegmentSwitcher.astroUsage contract
- Use links for navigation and buttons for in-page choices. Exactly one current/pressed item.
Examples
- segment
<div class="flex flex-wrap items-center gap-6"> <SegmentSwitcher name="lang-demo" mode="links" label={t(locale, 'lang.label')} items={[{value: 'de', label: 'DE', lang: 'de', href: localePath('de', '/design-system/'), current: locale === 'de'}, {value: 'en', label: 'EN', lang: 'en', href: localePath('en', '/design-system/'), current: locale === 'en'}]} /> <SegmentSwitcher name="theme-demo" mode="buttons" label={t(locale, 'switch.theme')} items={[{value: 'system', label: t(locale, 'theme.system'), current: true}, {value: 'light', label: t(locale, 'theme.light')}, {value: 'dark', label: t(locale, 'theme.dark')}]} /> </div>
API
Extracted from the source with the TypeScript parser. Inherited and imported types remain references; implementation is authoritative.
interface Item { value: string; label: string; href?: string; current?: boolean; lang?: string; icon?: string; attributes?: Record<string,string> }interface Props { name: string; label: string; mode: 'links' | 'buttons'; items: Item[]; class?: string; size?: 'default' | 'icon'; attributes?: Record<string,string> }Astro.props
Bindings and defaults read from source; these do not add inferred types.
namelabelmodeitemsclass = ''size = 'default'attributes = {}
Source usage
Website reference
This is static source evidence. A reachable module may contain conditional or unused branches. External consumers and staged static pages are outside this scan. No status authorizes deletion.
Website
- src/pages/en/work/index.astro
- src/components/site/work/WorkCityPage.astro
- src/components/SegmentSwitcher.astro
Documentation
- src/pages/design-system/[category].astro
- src/components/ds/DesignSystemPage.astro
- src/components/SiteHeader.astro
- src/components/SegmentSwitcher.astro
Preview
- src/pages/en/vorschlag/work-case-cards.astro
- src/components/site/work/WorkCityPage.astro
- src/components/SegmentSwitcher.astro
Consumers in source
Direct static, dynamic and type imports. Imports do not prove that a branch renders or that a proposal is published.
Dependencies
./Zeichen.astro·src/components/Zeichen.astro@/scripts/theme.ts·src/scripts/theme.ts