Input
This section demonstrates the different text input types.
| install | yarn add @clayui/form |
|---|---|
| version | |
| use | import {ClayCheckbox} from '@clayui/form'; |
Table of Contents
ClayInput is exported from the @clayui/form package, consisting of some low-level utilities that provides the ability to create Inputs and Input Groups.
Basic Usage
import {Provider} from '@clayui/core'; import Form, {ClayInput} from '@clayui/form'; import React, {useState} from 'react'; import '@clayui/css/lib/css/atlas.css'; export default function App() { return ( <Provider spritemap="/public/icons.svg"> <div className="p-4"> <Form.Group> <label htmlFor="basicInputText">Name</label> <ClayInput id="basicInputText" placeholder="Insert your name here" type="text" /> </Form.Group> </div> </Provider> ); }
Using another elements as an input
If you want to use another component instead of input for enter text typed things, you can just pass this tag to component property, like the example below:
import {Provider} from '@clayui/core'; import Form, {ClayInput} from '@clayui/form'; import React, {useState} from 'react'; import '@clayui/css/lib/css/atlas.css'; export default function App() { return ( <Provider spritemap="/public/icons.svg"> <div className="p-4"> <Form.Group> <label htmlFor="basicInputText">Name</label> <ClayInput component="textarea" id="basicInputText" placeholder="Insert your name here" type="text" /> </Form.Group> </div> </Provider> ); }
Table of Contents