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'