<div id="root"></div>
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
  font-family: Arial;
}

body {
  background: rgba(0, 0, 0, 0.25);
}

.card {
  display: block;
  width: 300px;
  height: 300px;
  position: relative;
  background: white;
  margin: 50px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 0;
  .toggle {
    cursor: pointer;
    padding: 10px;
    margin: 2px 2px 0 0;
    transition: background 0.25s;

    &:hover,
    &.active {
      background: rgba(0, 0, 0, 0.05);
    }
  }
  .menu {
    position: absolute;
    right: 25px;
    top: 10px;
    overflow: hidden;
    width: 0;
    height: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    ul {
      list-style: none;

      li {
        cursor: pointer;
        width: 100%;
        padding: 10px 10px;
        transition: background 0.25s, color 0.25s;
        display: flex;
        align-items: center;

        &:hover {
          color: rgb(0, 125, 255);
          background: rgba(0, 0, 0, 0.025);
        }

        .label {
          margin-left: 10px;
        }
      }
    }

    &.expanded {
      width: 120px;
      height: auto;
    }
  }
}
class App extends React.Component {
	render() {
		const menuItems = [
			{
				label: 'Clone',
				icon: 'fa fa-clone',
				onClick: () => alert('Clone')
			},
			{
				label: 'Share',
				icon: 'fa fa-bullhorn',
				onClick: () => alert('Share')
			},
			{
				label: 'Delete',
				icon: 'fa fa-trash-o',
				onClick: () => alert('Delete')
			}
		];
		return (
			<div className="card">
				<DropdownMenu items={menuItems} />
			</div>
		);
	}
}

class DropdownMenu extends React.Component {
	constructor(props) {
		super(props);

		this.state = {
			active: false
		};

		this.toggle = this.toggle.bind(this);
    this.close = this.close.bind(this);
	}

	toggle() {
		this.setState(previous => ({
			active: !previous.active
		}));
	}
  
  close() {
    this.setState({
       active: false
    });
  }

	render() {
		const items = this.props.items;
		const active = this.state.active;

		return (
			<div className="dropdown-menu" tabIndex="0" onBlur={this.close}>
				<div className={`toggle ${active ? 'active' : ''}`} onClick={this.toggle}>
					<span>
						<i className="fa fa-ellipsis-v" />
					</span>
				</div>
				<div className={`menu ${active ? 'expanded' : 'collapsed'}`}>
					<ul>
						{items.map((i,index) => (
							<li key={index} onClick={i.onClick}>
								<span>
									<i className={i.icon} />
								</span>
								<span className="label">{i.label}</span>
							</li>
						))}
					</ul>
				</div>
			</div>
		);
	}
}

ReactDOM.render(<App />, document.getElementById('root'));
View Compiled

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/16.4.0/umd/react.development.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.0/umd/react-dom.development.js