Flags
Flags renders a country flag from the Click UI flag set. Use it next to region and country names, for example in a region picker.
Example
Props
Flags also accepts the attributes of an svg element.
Prop | Type | Default value | Description |
|---|---|---|---|
Prop name * | Type FlagName | Default value required | Description The flag to show, in kebab case, for example united-states |
Prop size | Type "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | Default value undefined | Description The size of the flag |
Prop theme | Type "light" | "dark" | Default value current theme | Description Forces the light or dark version of the flag |
* denotes required field
Quick start
import { Flags, Text, Container } from '@clickhouse/click-ui'
function Region() {
return (
<Container orientation='horizontal' gap='sm' alignItems='center'>
<Flags name='ireland' size='sm' aria-hidden='true' />
<Text>Europe (Ireland)</Text>
</Container>
)
}Accessibility
Flags renders with role="img" and uses the flag name as its accessible name. When the flag sits next to the country name it is decorative, so pass aria-hidden="true" to stop the name being announced twice.
Related components
- Icon: Icon also accepts flag names.
- Logo: For company and product logos.
- Select: Options can show a flag through their icon prop.