import { Layout, Playground, Attributes } from 'lib/components' import GitIcon from 'lib/components/icons/github' import { Input, Spacer, useInput, Button, Code, Text, Dot } from 'components' import { useState, useEffect } from 'react' export const meta = { title: 'Input', description: 'avatar', } ## Input Retrieve text input from a user. `} /> `} /> `} /> `} /> `} /> Username Title Problem area for deployment `} /> `} /> } placeholder="The Evil Rabbit" /> `} /> `} /> { const [value, setValue] = useState() const handler = (e) => { setValue(e.target.value) console.log(e.target.value) } return ( ) } `} /> With useInput} scope={{ Input, useInput, useEffect, Button, Spacer }} code={` () => { const { state, setState, reset, bindings } = useInput('The Evil Rabbit') useEffect(() => console.log(state), [state]) return ( <> ) } `} /> Input.Props | Attribute | Description | Type | Accepted values | Default | ---------- | ---------- | ---- | -------------- | ------ | | **value** | input value | `string` | - | - | | **initialValue** | inital value | `string` | - | - | | **placeholder** | placeholder | `string` | - | - | | **size** | input size | `NormalSizes` | `'mini', 'small', 'medium', 'large'` | `medium` | | **status** | current status | `NormalTypes` | `'default', 'secondary', 'success', 'warning', 'error'` | `default` | | **readOnly** | native attr | `boolean` | - | `false` | | **disabled** | disable input | `boolean` | - | `false` | | **clearable** | show clear icon | `boolean` | - | `false` | | **label** | text label for input | `string` | - | - | | **icon** | icon for input | `React.ReactNode` | - | - | | **labelRight** | text label at right for input | `string` | - | - | | **iconRight** | icon at right for input | `React.ReactNode` | - | - | | **onChange** | change event | `(e: React.ChangeEvent) => void` | - | - | | **onClearClick** | clear icon event | `(e: React.MouseEvent) => void` | - | - | | ... | native props | `InputHTMLAttributes` | `'alt', 'type', 'className', ...` | - | useInput ```ts type useInput = (initialValue: string) => { state: string setState: Dispatch> currentRef: MutableRefObject reset: () => void bindings: { value: string onChange: (event: React.ChangeEvent) => void } } ``` export default ({ children }) => {children}