import { useState } from 'react' import { Button, FormField, Icon, Input, Space, Text } from '../../src' import { Demo } from '../components/Demo' import { PropsTable } from '../components/PropsTable' import { Section } from '../components/Section' export function Inputs() { const [keyword, setKeyword] = useState('') const [host, setHost] = useState('127.0.0.1:8080') const [email, setEmail] = useState('not-an-email') return (
setKeyword(event.target.value)} clearable onClear={() => setKeyword('')} />`} > setKeyword(event.target.value)} clearable onClear={() => setKeyword('')} style={{ width: 320 }} /> 当前值:{keyword === '' ? '(空)' : keyword} setHost(event.target.value)} />`} > setHost(event.target.value)} style={{ width: 320 }} /> `} > `} > `} >
setEmail(event.target.value)} /> 当前值:{email}
void', desc: '点击清除;不传则不显示按钮' }, { name: 'shortcut', type: 'string', desc: '右侧快捷键提示(仅展示)' }, { name: 'inputRef', type: 'Ref', desc: '拿到真实 input,用于聚焦' }, { name: 'className / style', type: 'string / CSSProperties', desc: '作用在外层容器上(宽度、外边距)' }, { name: '…rest', type: 'InputHTMLAttributes', desc: '透传原生属性,onChange 是原生事件' }, ]} />
) }