ProjectSwitcher
Which project of the organization. With more than seven, a filter at the top of the list finds one by name.
import { ProjectSwitcher } from '@sypnia/ui/react'
On this page
Nine projects
Open it and write «app».
Code
import { useState } from 'react';
import { ProjectSwitcher } from '@sypnia/ui/react';
// With more than seven projects a filter appears at the top of the list.
const names = ['shop', 'analytics', 'billing', 'marketing-site', 'mobile-app', 'internal-tools', 'staging-copy', 'experiments', 'archive-2025'];
export default function Projects() {
const [project, setProject] = useState('shop');
return <ProjectSwitcher current={project} onChange={setProject} options={names.map((n, i) => ({ id: n, name: n, detail: i % 3 ? 'Frankfurt' : 'Virginia' }))} />;
} When to use it
Use it when
- After the OrgSwitcher, separated by a slash.
- Show the region or the plan in
detail.
Do not use it when
- Changing project inside a form with unsaved changes: save first.
For everyone
- The filter is a search box; the arrow keys go down into the list.
- When nothing matches it says so.
Props
| ProjectSwitcher | Type | Default |
|---|---|---|
currentrequired | string | |
onChangerequired | (id: string) => void | |
optionsrequired | SwitcherOption[] | |
compact | boolean | |
createLabelThe thing to create: «organization». Defaults to `kind`. | string | |
kind | string | |
onCreateAdds «Create …» at the end of the list. | (() => void) | |
onSettingsAdds a settings entry at the end of the list («Organization settings» on the OrgSwitcher). | (() => void) | |
settingsLabelThe words of that entry. | string |