Pular para o conteúdo principal

Dropdown

import { Dropdown } from '@resultadosdigitais/tangram-components'
Concerns
📍 Required
Typenode | func

Description

Sets the children, which usually contains Dropdown.Container, Dropdown.Header and Dropdown.Footer.

Typefunc
ParamanchorRef React.Dispatch - Reference that must be passed to the ref property of the anchor component that will be rendered.
Paramtoggle Function - Function that opens and closes the Dropdown in the uncontrolled version.

Description

Function responsible for rendering the Dropdown anchor.

Typebool

Description

Responsible for controlling if Dropdown will be rendered opened or closed in the uncontrolled version.

Typeinstance of Element

Description

Sets the anchor element (html element). Only used in the controlled version.

Typebool

Description

Controls whether Dropdown will be rendered opened in the controlled version.

Type
Enum of:
  • Dropdown.positions.top
  • Dropdown.positions.topStart
  • Dropdown.positions.topEnd
  • Dropdown.positions.right
  • Dropdown.positions.rightStart
  • Dropdown.positions.rightEnd
  • Dropdown.positions.left
  • Dropdown.positions.leftStart
  • Dropdown.positions.leftEnd
  • Dropdown.positions.bottom
  • Dropdown.positions.bottomStart
  • Dropdown.positions.bottomEnd
DefaultDropdown.positions.bottomStart

Description

Determines the position of Dropdown relative to the anchor element.

deprecated values:

  • Dropdown.positions.top,
  • Dropdown.positions.right,
  • Dropdown.positions.bottom,
  • Dropdown.positions.left
Typenumber | string
DefaultsizeSpacing01

Description

Sets the distance between the Dropdown and the anchor element. Use as a number or a string with unit px.

Typefunc
Paramevent React.SyntheticEvent - The event source of the callback.

Description

Callback triggered when the Dropdown is open and outside of dropdown is clicked.

Typefunc
Paramevent React.SyntheticEvent - The event source of the callback.

Description

Callback triggered when the Dropdown is opened and ESC key is pressed.

Typefunc
Paramevent React.SyntheticEvent - The event source of the callback.

Description

Callback triggered when the Dropdown is focused and any key is pressed.

Typefunc
Paramevent React.SyntheticEvent - The event source of the callback.
Paramopen boolean - Dropdown open state.
Paraminfos object - Additional information about component status.
  • infos.reason string - The reason to toggle the Dropdown. Can be Dropdown.reasonsToToggle.escape, Dropdown.reasonsToToggle.clickOutside, Dropdown.reasonsToToggle.clickItem or Dropdown.reasonsToToggle.clickAnchor.

Description

Callback triggered when the Dropdown requests to be closed or opened.

Typebool
Defaultfalse

Description

Controls whether Dropdown will mount without focus.

Typebool
Defaultfalse

Description

Sets if the Dropdown will be always mounted after the first mount. It can be useful for SEO.

Concerns
🗑️ Deprecated: - `Dropdown` from now on will use the trigger id automatically.
Typestring | number

Description

Sets the id used to connect accessibly Dropdown with anchor element. The id value is used in aria-labelledby.

Concerns
🗑️ Deprecated: - Use `unfocused` property instead.
Typebool
Defaulttrue

Description

Sets if Dropdown will mount with focus or not.

import { DropdownAnchor } from '@resultadosdigitais/tangram-components'
Typenode
Description

Sets the children.

import { DropdownCheckbox } from '@resultadosdigitais/tangram-components'
Typestring
Default''
Description

Sets the auxiliary text.

Typebool
Defaultfalse
Description

Sets the Checkbox checked by default. Used for uncontrolled component.

Typebool
Defaultfalse
Description

Disables the Dropdown.Checkbox.

Concerns
📍 Required
Typestring
Description

Sets the label.

Typebool
Defaultfalse
Description

Identifies that the label and the auxiliary text will be truncated when it exceeds the available size.

Typenode
Description

Sets a content to be displayed at the end of the item.

import { DropdownContainer } from '@resultadosdigitais/tangram-components'
Typenode
Description

Sets the children.

Typestring | func
Description

Sets the text to be displayed when content not exists or is hidden. If you want to customize the renderization of this property, you must pass a component instead.

renderEmptyState="No items were found"
renderEmptyState={() => <MyComponent>No items were found</MyComponent>}
Typebool
Defaultfalse
Description

Sets loading appearance.

import { DropdownCustomItem } from '@resultadosdigitais/tangram-components'
TypeelementType | string
Default'div'
Description

Set element type to be rendered for this component. By default it will be render a <div> element.

Concerns
📍 Required
Typenode
Description

Sets the children.

Typebool
Defaultfalse
Description

Disables the Dropdown.CustomItem.

TypeError to identify property type
Defaultfalse
Description
TypeError to identify property type
Default'menuitem'
Description
import { DropdownDivider } from '@resultadosdigitais/tangram-components'
import { DropdownFooter } from '@resultadosdigitais/tangram-components'
Typenode
Description

Sets the children.

import { DropdownHeader } from '@resultadosdigitais/tangram-components'
Typenode
Description

Sets the children.

import { DropdownItem } from '@resultadosdigitais/tangram-components'
TypeelementType | string
Default'div'
Description

Set element type to be rendered for this component. By default it will be render a <div> element.

If the component has the href prop, it will be render as a link <a> regardless of the value of as prop.

Typebool
Defaultfalse
Description

Disables the Dropdown.Item.

Concerns
📍 Required
Typestring
Description

Sets the label, the main text displayed by the component.

Typestring
Description

Sets the auxiliary text.

Typebool
Defaultfalse
Description

Indicates if the item is visually dangerous.

Typebool
Defaultfalse
Description

Identifies that the label and the auxiliary text will be truncated when it exceeds the available size.

Typebool
Defaultfalse
Description

Indicates if the item is selected.

Typenode
Description

Sets icon to be displayed at the beginning of the item.

Typenode
Description

Sets a content to be displayed at the end of the item.

import { DropdownLevels } from '@resultadosdigitais/tangram-components'
Concerns
📍 Required
Typenumber | string
Description

Sets the first level to be rendered.

Concerns
📍 Required
Typefunc
Paramprops Object - The props that will be passed to the inner component.
  • props.level string|number - Returns the level to be rendered.
  • props.goToLevel Function - Function that triggers the render of a specific level. A level name needs to be passed as argument.
  • props.goBack Function - Function that triggers the last level render.
  • props.toggle Function - Function that opens or closes the Dropdown.
Description

Function responsible to render the multiple Dropdown levels.

import { DropdownNavigation } from '@resultadosdigitais/tangram-components'
Typestring
Description

Sets the auxiliary text.

Typebool
Defaultfalse
Description

Disables the Dropdown.Navigation.

Concerns
📍 Required
Typestring
Description

Sets the label.

import { DropdownTitle } from '@resultadosdigitais/tangram-components'
Concerns
📍 Required
Typenode
Description

Sets the children element

Feedback