DsChip class
A pill-shaped chip with optional selection state and remove button.
Supports keyboard activation (Enter/Space to tap, Delete to remove) and a subtle hover state, matching the official Designsystemet chip / DsButton. The chip shows a visible focus ring while focused. For a DsChip.removable chip the remove icon is a separately focusable button that activates with Enter/Space, in addition to Delete pressing on the chip itself.
Set disabled to render the chip as non-interactive (dimmed, no hover, no activation, basic cursor). A focusNode and a size override are exposed for parity with other interactive components.
The default constructor renders a generic chip. For behaviour that mirrors the React chip parts, use the named constructors:
- DsChip.button — a clickable action chip (
Chip.Button). - DsChip.removable — a chip with a remove icon (
Chip.Removable). - DsChip.checkbox — a toggleable, multi-select chip (
Chip.Checkbox). - DsChip.radio — a single-select chip (
Chip.Radio).
- Inheritance
Constructors
- DsChip({Key? key, required Widget child, DsSize? size, DsColor? color, bool removable = false, bool selected = false, bool disabled = false, VoidCallback? onRemove, VoidCallback? onTap, FocusNode? focusNode})
-
const
-
A clickable action chip, mirroring React
Chip.Button.const -
DsChip.checkbox({Key? key, required Widget child, required bool selected, required ValueChanged<
bool> onChanged, bool disabled = false, DsSize? size, DsColor? color, FocusNode? focusNode}) -
A toggleable, multi-select chip, mirroring React
Chip.Checkbox. - DsChip.radio({Key? key, required Widget child, required bool selected, required VoidCallback onChanged, bool disabled = false, DsSize? size, DsColor? color, FocusNode? focusNode})
-
A single-select chip, mirroring React
Chip.Radio.const - DsChip.removable({Key? key, required Widget child, required VoidCallback onRemove, bool disabled = false, DsSize? size, DsColor? color, FocusNode? focusNode})
-
A chip that shows a remove icon, mirroring React
Chip.Removable.const
Properties
- child → Widget
-
The chip's label content.
final
- color → DsColor?
-
Color override; falls back to the nearest DsColorScope.
final
- disabled → bool
-
Whether the chip is non-interactive (dimmed, no hover, no activation).
final
- focusNode → FocusNode?
-
An optional focus node for the chip body.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onRemove → VoidCallback?
-
Called when the remove icon is activated (or Delete is pressed).
final
- onTap → VoidCallback?
-
Called when the chip body is activated (tap, Enter or Space).
final
- removable → bool
-
Whether the chip shows a remove icon.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selected → bool
-
Whether the chip renders in its selected/active visual state.
final
- size → DsSize?
-
Size override; falls back to the nearest DsSizeScope.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DsChip> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited