RegionSelect
Where data lives: each region with its city and code. The choice usually cannot change later, so say it in the hint.
import { RegionSelect } from '@sypnia/ui/react'
A project's region
Choose the one closest to your users. It cannot be changed later.
Code
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>;
} When to use it
Use it when
- Creating a project, a bucket, a database.
Do not use it when
- Countries of people: use a country list.
For everyone
- It is a select; the city and code are read with each option.
Props
| RegionSelect | Type | Default |
|---|---|---|
regionsrequired | 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 |