ant-design/components/mentions/demo/status.md
MadCcc 65bf6550b1
feat: mentions support status (#34071)
* test: skip form deps-lint

* perf: remove useless has-feedback classname

* test: raise test coverage

* style: recover import arrangement
2022-02-16 21:14:05 +08:00

1.0 KiB

order title
8
zh-CN en-US
自定义状态 Status

zh-CN

使用 status 为 Mentions 添加状态。可选 error 或者 warning

en-US

Add status to Mentions with status, which could be error or warning

import { Mentions, Space } from 'antd';

const { Option } = Mentions;

function onChange(value) {
  console.log('Change:', value);
}

function onSelect(option) {
  console.log('select', option);
}

const MentionsStatuses = () => {
  const options = (
    <>
      <Option value="afc163">afc163</Option>
      <Option value="zombieJ">zombieJ</Option>
      <Option value="yesmeck">yesmeck</Option>
    </>
  );

  return (
    <Space direction="vertical">
      <Mentions onChange={onChange} onSelect={onSelect} defaultValue="@afc163" status="error">
        {options}
      </Mentions>
      <Mentions onChange={onChange} onSelect={onSelect} defaultValue="@afc163" status="warning">
        {options}
      </Mentions>
    </Space>
  );
};

ReactDOM.render(<MentionsStatuses />, mountNode);