Nhảy tới nội dung

Select

Properties

Select

NameTypeDefaultDescriptionMinimum Version
valueSelectValue | Array

Option/ Các Option đã chọn, controlled component

defaultValueSelectValue | Array

Option/ Các Option chọn lúc khỏi tạo, uncontrolled component

multiplebooleanfalse

Bật chế độ chọn nhiều option

defaultOpenbooleanfalse

Mặc định mở select bottom sheet hay không

closeOnSelectbooleanfalse

Đóng select sheet modal khi chọn option (single choice)

1.5.5
disabledboolean

Vô hiệu hoá Select input

onChangefunction

Thêm event handler khi thay đổi option lựa chọn

onVisibilityChangefunction

Thêm event handler khi select bottom sheet thay đổi trạng thái mở/đóng

labelstring

Thêm Label hiển thị phía trên Input và tiêu đề cho Select Input và Select bottom sheet

helperTextstring

Helper text hiển thị phía dưới của field input.

errorTextstring

Text hiển thị khi status của field input là error

statusInputStatus

Trạng thái của field input. Nhận các giá trị: success | error

namestring

Thêm name cho input field

placeholderstring

Thêm placeholder cho input trong trường hợp không có option nào đã được chọn

Example

import React from "react";
import { Select } from "zmp-ui";
const { OtpGroup, Option } = Select;

export default () => {
return (
<Select
label="Label"
helperText="Helper text"
placeholder="Placeholder"
defaultValue="1"
>
<OtpGroup label="Group 1">
<Option value="1" title="Option 1" />
<Option value="2" title="Option 2" />
</OtpGroup>
<OtpGroup label="Group 2">
<Option value="3" title="Option 3" />
<Option value="4" title="Option 4" />
<Option value="5" title="Option 5" disabled />
<Option value="6" title="Option 6" />
</OtpGroup>
</Select>
);
};
import React from "react";
import { Select } from "zmp-ui";
const { OtpGroup, Option } = Select;

export default () => {
return (
<Select
label="Label"
helperText="Helper text"
placeholder="Placeholder"
multiple
defaultValue={[]}
>
<Option value="1" title="Option 1" />
<Option value="2" title="Option 2" />
<Option value="3" title="Option 3" />
<Option value="4" title="Option 4" />
<Option value="5" title="Option 5" disabled />
<Option value="6" title="Option 6" />
</Select>
);
};