Skip to main content

SelectableCard

The SelectableCard is an interactive component used to display information that leads end-consumers to a choice or selection.

Import

// with @dhl-official/react-library:
import { DhlSelectableCard } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlSelectableCard } from "@dhl-official/ui-libraries/react-library"

Code

<DhlSelectableCard isChecked={true}>Example Text</DhlSelectableCard>

Interactive Demo

Migrating from DUIL 1.0

  • Rename onChange to changeEvent
  • RemoveisFullBleed
  • Remove isBlock
  • Add formnovalidate

Readme

Properties

PropertyAttributeDescriptionTypeDefault
changeEvent--An optional onChange callback handler - see the Example use-case section for implementation example.(event: Event) => voidundefined
dataAriaDescribedbydata-aria-describedbyAn optional prop defining the list of reference IDs (separated by spaces), recommended when you want to an error message on your field.stringundefined
dataAriaInvaliddata-aria-invalidAn optional prop used to indicate that the form value of the component does not conform to the expected format.stringundefined
dataAriaLabeldata-aria-labelAn optional prop defining the text read by the screen reader to represent the component; use this if you need different text to be read from label.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.stringdhl-selectable-card-${getRandomString()}
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.stringundefined
dataTrackingdata-trackingAn optional data tracking prop for the component.stringundefined
focusVariantfocus-variantAn optional focusVariant prop for the Card component. Sets color of focus."primary" \| "secondary"DHL_SELECTABLE_CARD.FOCUS_VARIANT.SECONDARY
hasOtherActionshas-other-actionsAn optional prop defining whether there are other actions in the card, which will not trigger the checkboxbooleanfalse
isCheckedis-checkedAn optional prop used to describe either a checked or unchecked state of the SelectableCardbooleanfalse
isRequiredis-requiredAn optional prop used to toggle if the the component is required.booleanundefined
namenameAn optional value to be set to the element HTML name attribute. It takes any valid value that can be used for the name attribute of an HTMLInputElement.stringundefined
valuevalueAn optional prop defining the value of the component which is taken when a form is submitted.stringundefined

Slots

SlotDescription
"footer"used for elements intended to be positioned as the DhlSelectableCard footer
"header"used for elements intended to be positioned as the DhlSelectableCard header
"unnamed"unnamed children slot for DhlSelectableCard content

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!