Dropdown

A menu that appears below a title when it is selected and remains until used or dismissed.

Preview

Usage

It uses the useDropdown hook for handling the logic.

npm i react-hartan
import { Dropdown } from "react-hartan"

function App() {

  return (
    <>
      <Dropdown></Dropdown>
    </>
  )
}

export default App

Customization With Props

  • listItem -> This prop accepts an array of nodes, used as the dropdown list, to be sent by user.

  • buttonText -> This prop accepts a value, used as the button name.

  • onClickFunction -> The custom on click function passed by the user for handling click logic.

  • id -> The id prop is similar to the id attribute in HTML. It allows to provide overall component id.

  • userDropdownStyle -> The custom styling prop for the full dropdown.

  • userDropdownListStyle -> The custom styling prop for the list container containing list items.

  • userDropdownListItemStyle -> The custom styling prop for each list item inside the list container.

  • userButtonStyle -> The custom styling for the button opening/closing dropdown.

import { Dropdown } from "react-hartan"

function App() {

  return (
    <>
      <Dropdown></Dropdown>
    </>
  )
}

export default App

Component Code

This is the code for Dropdown component.

Last updated