RegionSelect
Dónde viven los datos: cada región con su ciudad y su código. La elección casi nunca se puede cambiar después, así que dilo en la ayuda.
import { RegionSelect } from '@sypnia/ui/react'
En esta página
La región de un proyecto
Choose the one closest to your users. It cannot be changed later.
Código
import { useState } from 'react';
import { Field, RegionSelect } from '@sypnia/ui/react';
// Where the data lives. It cannot change later, so the hint says so.
export default function Where() {
const [r, setR] = useState('eu-central-1');
return <Field label="Region" hint="Choose the one closest to your users. It cannot be changed later."><RegionSelect value={r} onChange={setR} regions={[
{ id: 'us-east-1', name: 'Virginia', location: 'United States' }, { id: 'eu-central-1', name: 'Frankfurt', location: 'Germany' }, { id: 'sa-east-1', name: 'São Paulo', location: 'Brazil' },
]} /></Field>;
} Cuándo usarlo
Úsalo cuando
- Crear un proyecto, un bucket, una base de datos.
No lo uses cuando
- Países de personas: usa una lista de países.
Para todos
- Es un selector; la ciudad y el código se leen con cada opción.
Props
| RegionSelect | Tipo | Por defecto |
|---|---|---|
regionsobligatorio | Region[] | |
aria-describedby | string | |
aria-labelThe name for screen readers when there is no Field around it. | string | |
aria-labelledby | string | |
className | string | |
disabled | boolean | |
idInside a Field it comes from the Field. | string | |
name | string | |
onChange | ((id: string) => void) | |
value | string |