@ gluestack 风格/ 输入
安装
用于 @gluestack-ui/input,你只需要安装
@gluestack-ui/input 软件包 :
$ yarn add @gluestack-ui/input
# or
$ npm i @gluestack-ui/input
使用量
输入组件是您用于在一个 sleek 和 方便用户的文本字段中收集用户输入的工具 。 无论是在设计一个简单的登录表还是复杂的搜索功能,这个组件都覆盖了您. 以下是如何使用这个软件包来创建一个:
import { Root, Input } from '../components/core/input/styled-components';
import { createInput } from '@gluestack-ui/input';
const InputField = createInput({
Root,
Input,
});
自定义输入 :
所有这些组件的默认样式可以在组件/核心/输入文件中找到. 作为参考,你可以查看 源代码 样式 input 组件.
// import the styles
import { Root, Input } from '../components/core/input/styled-components';
// import the createInput function
import { createInput } from '@gluestack-ui/input';
//import any icon
import { searchIcon } from '@gluestack/icons';
// Understanding the API
const InputField = createInput({
Root,
Input,
});
// Using the input component
export default () => (
<Input>
<InputSlot pl="$3">
<InputIcon as={SearchIcon} />
</InputSlot>
<InputInput placeholder="your text goes here..." />
</Input>
);
更多关于如何启动的指南 这里。 。 。 .