0

I am attempting to make a dropdown menu using Semantic UI that shows itself onclick but do not know how to show it. Right now when I click I just console.log "hi".

import React from "react";

class Dropdown extends React.Component {
  state = {};

  onClick = () => {
    console.log("hi");
  };

  render() {
    return (
      <div onClick={() => this.onClick()} class="ui selection dropdown">
        <input type="hidden" name="gender" />
        <i class="dropdown icon"></i>
        <div class="default text">Gender</div>
        <div class="menu">
          <div class="item" data-value="1">
            Male
          </div>
          <div class="item" data-value="0">
            Female
          </div>
        </div>
      </div>
    );
  }
}

export default Dropdown;
0

1 Answer 1

1

For React you should use semantic-ui-react and not semantic-ui directly.

I am not sure if you have gone through the document or not, but it's available https://react.semantic-ui.com/modules/dropdown/#types-selection. It also contains examples which you can use.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.