Ir al contenido

OrgSwitcher

En qué organización trabaja la persona. La actual con sus iniciales en la barra superior; las demás en una lista, y «Crear organización» al final.

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

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

Organizaciones

Código
import { useState } from 'react';
import { OrgSwitcher, toast } from '@sypnia/ui/react';

// The current organization with its initials; the others in a list; «Create organization» and its settings at the end.
export default function Orgs() {
  const [org, setOrg] = useState('acme');
  return <OrgSwitcher current={org} onChange={setOrg} onCreate={() => toast('Create an organization')} onSettings={() => toast('Organization settings')}
    options={[{ id: 'acme', name: 'Acme', detail: 'Pro · 4 projects' }, { id: 'north', name: 'Northwind', detail: 'Free · 1 project' }, { id: 'personal', name: 'Ana Ruiz', detail: 'Personal' }]} />;
}

Cuándo usarlo

Úsalo cuando

  • Primero en la barra superior, antes del proyecto.
  • Agrega detail con el plan o el número de proyectos.

No lo uses cuando

  • Personas que pertenecen a una sola organización: muestra su nombre, no un selector.

Para todos

  • El botón dice qué cambia y cuál es la actual: «Cambiar de organización: Acme».
  • La actual va marcada en la lista; las flechas se mueven y escribir salta.

Props

OrgSwitcherTipoPor 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. Organizaciones
  2. Cuándo usarlo
  3. Para todos
  4. Props

    Busca páginas, secciones y términos