import * as React from 'react'import { Picker } from '@welcome-ui/picker'import { Shape } from '@welcome-ui/shape'import { EditIcon, PencilIcon } from '@welcome-ui/icons'const options = [{element: ({ selected }: { selected: boolean }) => (<Shape backgroundColor={selected ? 'nude-200' : 'unset'} shape="circle" w={40}><EditIcon color="dark-900" /></Shape>),value: 'edit',},{element: ({ selected }: { selected: boolean }) => (<Shape backgroundColor={selected ? 'nude-200' : 'unset'} shape="circle" w={40}><PencilIcon color="dark-900" /></Shape>),value: 'pencil',},]const Example = () => {const [value, setValue] = React.useState('edit')// TODO: fix typescript// eslint-disable-next-line @typescript-eslint/ban-ts-comment// @ts-ignoreconst handleChange = event => {setValue(event.target.value)}return <Picker name="icon" onChange={handleChange} options={options} value={value} />}export default Example
Installation
1
Run the following command:
yarn add @welcome-ui/picker
2
Import component:
import { Picker } from '@welcome-ui/picker'