Skip to content

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
  1. Nine projects
  2. When to use it
  3. For everyone
  4. Props

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

ProjectSwitcherTypeDefault
currentrequired string
onChangerequired (id: string) => void
optionsrequired SwitcherOption[]
compact boolean
createLabel

The thing to create: «organization». Defaults to `kind`.

string
kind string
onCreate

Adds «Create …» at the end of the list.

(() => void)
onSettings

Adds a settings entry at the end of the list («Organization settings» on the OrgSwitcher).

(() => void)
settingsLabel

The words of that entry.

string
  1. Nine projects
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms