Ir al contenido

ProjectSwitcher

Qué proyecto de la organización. Con más de siete, un filtro arriba de la lista encuentra uno por nombre.

import { ProjectSwitcher } from '@sypnia/ui/react'

En esta página
  1. Nueve proyectos
  2. Cuándo usarlo
  3. Para todos
  4. Props

Nueve proyectos

Ábrelo y escribe «app».

Código
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' }))} />;
}

Cuándo usarlo

Úsalo cuando

  • Después del OrgSwitcher, separado por una barra.
  • Muestra la región o el plan en detail.

No lo uses cuando

  • Cambiar de proyecto dentro de un formulario con cambios sin guardar: guarda primero.

Para todos

  • El filtro es un buscador; las flechas bajan a la lista.
  • Cuando nada coincide, lo dice.

Props

ProjectSwitcherTipoPor defecto
currentobligatorio string
onChangeobligatorio (id: string) => void
optionsobligatorio 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. Nueve proyectos
  2. Cuándo usarlo
  3. Para todos
  4. Props

    Busca páginas, secciones y términos