Input
- Guidelines
- Implementation
Input Field
Được sử dụng để nhập, gửi dữ liệu, vì vậy phải ngắn gọn và rõ ràng
Anatomy
Core elements (Required)
Luôn xuất hiện trong một input field

- Background
- Border
- Primary text
Types
Sử dụng các loại input field khác nhau để đáp ứng nhu cầu nhập nội dung khác nhau
Text Field
Để nhập nội dung đơn giản, trong 1 dòng

Password Field
Để nhập mật khẩu

Text Area
Để nhập nội dung dài

Search Field
Để nhập nội dung tìm kiếm, trong 1 dòng

Interaction
- Touch vào trigger action nhập text
OTP Field
Dùng để nhập OTP. Highlight từng số khi nhập

States
Enabled

Focus



Activated



Disabled

Không hiển thị:
- Clear icon
- Helper text
- Required label
Tạo giao diện ô nhập liệu cho phép người dùng nhập văn bản và lấy dữ liệu
Properties
Input
Name | Type | Default | Description |
---|---|---|---|
label | string | Label hiển thị phía trên của field input. | |
status | string | Trạng thái của field input. Nhận các giá trị: success | error | |
helperText | string | Helper text hiển thị phía dưới của field input. | |
errorText | string | Text hiển thị khi status của field input là error | |
clearable | boolean | Object | Nếu cho phép sẽ hiển thị clear icon. | |
maxLength | number | Giới hạn độ dài tối đa được phép nhập | |
onChange | function | Sự kiện khi giá trị input thay đổi. Nhận về giá trị được nhập |
Input.Password
Hỗ trợ tất cả các props của component Input
Name | Type | Default | Description |
---|---|---|---|
visibilityToggle | boolean | Hiển thị icon hiện/ẩn password |
import React from "react"; import { Page, Input } from "zmp-ui"; export default function HomePage(props) { return ( <Page className="section-container"> <Input.Password label="Label" helperText="Helper text" visibilityToggle /> </Page> ); }
Input.Search
Hỗ trợ tất cả các props của component Input
Name | Type | Default | Description |
---|---|---|---|
loading | boolean | Hiển thị icon loading khi trạng thái đang search | |
onSearch | function | Sự kiện khi người dùng search. Nhận về giá trị được nhập |
import React from "react"; import { Page, Input } from "zmp-ui"; export default function HomePage(props) { return ( <Page className="section-container"> <Input.Search label="Label" helperText="Helper text" loading onSearch={(text) => console.log(text)} /> </Page> ); }