Tags: React, CSS, Modal, Semantic UI, actions, trigger
<Button.Group>
  <Button>
    <Icon name="history" />
  </Button>
  <Button>
    <Icon name="edit" />
  </Button>
  <Modal
    trigger={(
      <Button
        icon
        title="Delete Employee"
      >
        <Icon name="trash" />
      </Button>
    )}
    header="Alert!"
    content="If you delete this employee then all related data"
    actions={[
      {
        key: 'yes',
        content: 'Yes',
        positive: true,
        onClick: () => {
          console.log(123);
        },
      },
      { key: 'no', content: 'No' },
    ]}
  />
</Button.Group>
trigger then it will be rendered as HTML code specified. (Usually we may render it as a button)actions
Yes Button with on click eventNo Button without any binded eventTags: React, Semantic UI, selector, value, selected option, dropdown
event.target.valueisundefinedfromevent:onChangeofDropdownin Semantic UI
Simply reach the second argument to get the value:
<Select
  placeholder="Select An Employee"
  options={props.employees}
  value={props.employeeId}
  title="employeeId"
  onChange={(e, res) => {
    const { title, value } = props;
    // title = employeeId
    // value = option value
  }}
/>
/* only for dropdown */
handleDropdownChange (props, e) {
  const { name, value } = props
  // ...
}
/* only for inputs */
handleInputChange (props, e) {
  const { name, value } = props
  // ...
}
For form inputs we can also capture the input via second argument
handleChange = (e, { name, value }) => this.setState({ [name]: value })
render() {
  const { name, email, submittedName, submittedEmail } = this.state
  return (
    <div>
      <Form onSubmit={this.handleSubmit}>
        <Form.Group>
          <Form.Input
            placeholder='Name'
            name='name'
            value={name}
            onChange={this.handleChange}
          />
          <Form.Input
            placeholder='Email'
            name='email'
            value={email}
            onChange={this.handleChange}
          />
          <Form.Button content='Submit' />
        </Form.Group>
      </Form>
      <strong>onChange:</strong>
      <pre>{JSON.stringify({ name, email }, null, 2)}</pre>
      <strong>onSubmit:</strong>
      <pre>{JSON.stringify({ submittedName, submittedEmail }, null, 2)}</pre>
    </div>
  )
}
See full instruction: https://react.semantic-ui.com/collections/form/#usage-capture-values
https://react.semantic-ui.com/modules/modal/#types-shorthand
| 文章标题 | React Semantic UI-CheatSheet | 
| 发布日期 | 2020-01-27 | 
| 文章分类 | Tech | 
| 相关标签 | #React #CSS |