Dropdown
Importβ
import { Dropdown } from '@resultadosdigitais/tangram-components'
Propertiesβ
children πβ
| Concerns | π Required |
|---|---|
| Type | node | func |
Descriptionβ
Sets the children,
which usually contains Dropdown.Container, Dropdown.Header and Dropdown.Footer.
renderAnchorβ
| Type | func |
|---|---|
| Param | anchorRef React.Dispatch - Reference that must be passed to the ref property of the anchor component that will be rendered. |
| Param | toggle Function - Function that opens and closes the Dropdown in the uncontrolled version. |
Descriptionβ
Function responsible for rendering the Dropdown anchor.
defaultOpenβ
| Type | bool |
|---|
Descriptionβ
Responsible for controlling if Dropdown will be rendered opened or closed in the uncontrolled version.
anchorElβ
| Type | instance of Element |
|---|
Descriptionβ
Sets the anchor element (html element). Only used in the controlled version.
openβ
positionβ
| Type | Enum of: |
|---|---|
| Default | Dropdown.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
offsetβ
| Type | number | string |
|---|---|
| Default | sizeSpacing01 |
Descriptionβ
Sets the distance between the Dropdown and the anchor element.
Use as a number or a string with unit px.
onClickOutsideβ
| Type | func |
|---|---|
| Param | event React.SyntheticEvent - The event source of the callback. |
Descriptionβ
Callback triggered when the Dropdown is open and outside of dropdown is clicked.
onEscapeβ
| Type | func |
|---|---|
| Param | event React.SyntheticEvent - The event source of the callback. |
Descriptionβ
Callback triggered when the Dropdown is opened and ESC key is pressed.
onKeyDownβ
| Type | func |
|---|---|
| Param | event React.SyntheticEvent - The event source of the callback. |
Descriptionβ
Callback triggered when the Dropdown is focused and any key is pressed.
onToggleβ
| Type | func |
|---|---|
| Param | event React.SyntheticEvent - The event source of the callback. |
| Param | open boolean - Dropdown open state. |
| Param | infos object - Additional information about component status. |
Descriptionβ
Callback triggered when the Dropdown requests to be closed or opened.
unfocusedβ
keepMountedβ
| Type | bool |
|---|---|
| Default | false |
Descriptionβ
Sets if the Dropdown will be always mounted after the first mount. It can be useful for SEO.
anchorId ποΈβ
| Concerns | ποΈ Deprecated: - `Dropdown` from now on will use the trigger id automatically. |
|---|---|
| Type | string | number |
Descriptionβ
Sets the id used to connect accessibly Dropdown with anchor element.
The id value is used in aria-labelledby.
focused ποΈβ
| Concerns | ποΈ Deprecated: - Use `unfocused` property instead. |
|---|---|
| Type | bool |
| Default | true |
Descriptionβ
Sets if Dropdown will mount with focus or not.
<DropdownAnchor />β
Importβ
import { DropdownAnchor } from '@resultadosdigitais/tangram-components'
Propertiesβ
childrenβ
<DropdownCheckbox />β
Importβ
import { DropdownCheckbox } from '@resultadosdigitais/tangram-components'
Propertiesβ
auxiliaryTextβ
defaultCheckedβ
| Type | bool |
|---|---|
| Default | false |
Descriptionβ
Sets the Checkbox checked by default. Used for uncontrolled component.
disabledβ
label πβ
truncateβ
| Type | bool |
|---|---|
| Default | false |
Descriptionβ
Identifies that the label and the auxiliary text will be truncated when it exceeds the available size.
suffixβ
<DropdownContainer />β
Importβ
import { DropdownContainer } from '@resultadosdigitais/tangram-components'
Propertiesβ
childrenβ
renderEmptyStateβ
| Type | string | 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>}
loadingβ
<DropdownCustomItem />β
Importβ
import { DropdownCustomItem } from '@resultadosdigitais/tangram-components'
Propertiesβ
asβ
| Type | elementType | string |
|---|---|
| Default | 'div' |
Descriptionβ
Set element type to be rendered for this component. By default it will be render a <div> element.
children πβ
disabledβ
selectedβ
| Type | Error to identify property type |
|---|---|
| Default | false |
Descriptionβ
roleβ
| Type | Error to identify property type |
|---|---|
| Default | 'menuitem' |
Descriptionβ
<DropdownDivider />β
Importβ
import { DropdownDivider } from '@resultadosdigitais/tangram-components'
<DropdownFooter />β
Importβ
import { DropdownFooter } from '@resultadosdigitais/tangram-components'
Propertiesβ
childrenβ
<DropdownHeader />β
Importβ
import { DropdownHeader } from '@resultadosdigitais/tangram-components'
Propertiesβ
childrenβ
<DropdownItem />β
Importβ
import { DropdownItem } from '@resultadosdigitais/tangram-components'
Propertiesβ
asβ
| Type | elementType | 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.
disabledβ
label πβ
| Concerns | π Required |
|---|---|
| Type | string |
Descriptionβ
Sets the label, the main text displayed by the component.
auxiliaryTextβ
dangerβ
truncateβ
| Type | bool |
|---|---|
| Default | false |
Descriptionβ
Identifies that the label and the auxiliary text will be truncated when it exceeds the available size.
selectedβ
iconβ
suffixβ
<DropdownLevels />β
Importβ
import { DropdownLevels } from '@resultadosdigitais/tangram-components'
Propertiesβ
rootLevel πβ
renderLevels πβ
| Concerns | π Required |
|---|---|
| Type | func |
| Param | props Object - The props that will be passed to the inner component. |
Descriptionβ
Function responsible to render the multiple Dropdown levels.
<DropdownNavigation />β
Importβ
import { DropdownNavigation } from '@resultadosdigitais/tangram-components'
Propertiesβ
auxiliaryTextβ
disabledβ
label πβ
<DropdownTitle />β
Importβ
import { DropdownTitle } from '@resultadosdigitais/tangram-components'