DeepWorks Studios Blazor Component Library

Demo user Administrator ยท Blazor Server Library 20261206222504-6e8ff32.dirty

DwsChip

A compact label - a selected value, a tag, a filter - with an optional icon or avatar, a remove button and a selected state. The chips of DwsAutoComplete, DwsSelect and DwsRichEdit are DwsChips.

API Reference

Basic

Text only by default: Text is the label.

Design
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Basic_Text" Text="Design" />

With an icon

Icon puts a decorative icon before the text.

Berlin
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Basic_Icon" Text="Berlin" Icon="@Icons.BS.GeoAltFill" />

With an avatar

AvatarImage or AvatarInitials put a small round avatar before the text.

Anna Berg
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Basic_Avatar" Text="Anna Berg" AvatarInitials="AB" />

Long labels

MaxWidth caps the width; a longer label ends with an ellipsis and shows in full in a tooltip.

A long label that is cut with an ellipsis
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Basic_Long" Text="A long label that is cut with an ellipsis" MaxWidth="180" />

Colours

Color tints the fill; the text stays in the theme's text colour, which keeps the contrast in both themes.

Primary Success Warning Error
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Color_Primary" Text="Primary" Color="DwsColor.Primary" />
<DwsChip Name="ChipDemo_Color_Success" Text="Success" Color="DwsColor.Success" />
<DwsChip Name="ChipDemo_Color_Warning" Text="Warning" Color="DwsColor.Warning" />
<DwsChip Name="ChipDemo_Color_Error" Text="Error" Color="DwsColor.Error" />

Outline appearance

Appearance Outline tints the border instead of the fill.

Outline
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Color_Outline" Text="Outline" Color="DwsColor.Info" Appearance="DwsAppearance.Outline" />

Sizes

Small, Medium and Large chips are 24, 32 and 40px tall.

Small Medium Large
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Size_Small" Text="Small" Size="DwsSize.Small" Removable="true" />
<DwsChip Name="ChipDemo_Size_Medium" Text="Medium" Removable="true" />
<DwsChip Name="ChipDemo_Size_Large" Text="Large" Size="DwsSize.Large" Removable="true" />

Disabled

Disabled dims the chip and disables its remove button.

Disabled
Show Code
Chip.razor

<DwsChip Name="ChipDemo_Disabled" Text="Disabled" Disabled="true" Removable="true" />

Interface-Description

Name Typ Default Description
Text string? null The label. Also names the remove button ("Remove {Text}").
ChildContent RenderFragment? null Custom content instead of Text. Still pass Text for the remove button's name.
Icon string? null An icon class (Icons.BS.Tag) before the text. Decorative.
AvatarImage string? null Image URL of a small round avatar before the text. Wins over Icon.
AvatarInitials string? null Initials for the avatar when there is no image.
AvatarColor DwsColor DwsColor.Primary Background of the avatar's initials.
Color DwsColor DwsColor.Undefined Undefined: a neutral chip. A colour tints the fill (Filled) or the border (Outline); the text stays var(--text).
Appearance DwsAppearance DwsAppearance.Filled Filled (tinted fill) or Outline (border, no fill). Other values count as Filled.
Size DwsSize DwsSize.Medium Small 24px, Medium 32px, Large 40px tall.
MaxWidth int? null Caps the width in pixels; longer text ends with an ellipsis and shows in a tooltip.
Tooltip string? null A native tooltip. Defaults to Text when MaxWidth may cut it.
Selectable bool false Makes the chip a toggle button: aria-pressed, a check mark while selected.
Selected bool false Whether a selectable chip is selected. Supports @bind-Selected; a bound parent may refuse a toggle.
OnClick EventCallback<MouseEventArgs> Raised when the chip is pressed. Makes the chip a button.
Removable bool false Shows the remove button (a DwsCloseButton, 44px touch target).
RemoveAriaLabel string? null ("Remove {Text}") The remove button's accessible name.
ShowRemoveTooltip bool true Shows the remove button's name as a native tooltip as well.
RemoveButtonAttributes Dictionary<string, object>? null Extra attributes of the remove button, e.g. tabindex="-1" and data-dws-keep-focus for a chip inside a text field.
Haptic DwsHapticFeedback DwsHapticFeedback.Selection Feedback when a clickable or selectable chip is pressed (removing plays Light).
Name Typ Description
SelectedChanged EventCallback<bool> Raised with the requested state when a selectable chip is toggled.
OnRemove EventCallback Raised when the remove button is pressed, or Delete / Backspace on a focused clickable chip.
Name Typ Default Description
Element ElementReference The associated web component. May be null if accessed before the component is rendered.
ComponentGuid Guid Unique identifier for the component.
TypeString string The name of the component type, obtained from reflection.
Authorized_RegisterEnabled bool false Indicates whether this component is enabled through a permission registry.
Authorized_RegisterSelected bool false Indicates whether this component is selected in permission selection mode.
GetInitializedState bool false Returns whether the component is initialized.
GetRenderModeState DwsRenderMode Returns the current render mode.
GetComponentState DwsComponentStateType Returns the current component state.
GetIsInteractiveState bool false Returns whether the component is interactive.
GetIsPrerenderingState bool false Returns whether the component is prerendering.
GetComponentLoadingState bool false Returns whether the component is loading.
IsFormBusy bool false Whether the DwsForm (or DwsFormBusyRegion) around the component is locked because its submit handler is running. The state itself is the cascaded FormBusyState (IDwsFormBusyState).
Name Typ Parameters Description
DebugInfo void Logs debug information about the component.
UpdateState void Updates the component's state and triggers StateHasChanged.
UpdateStateAsync Task Asynchronously updates the component's state and triggers StateHasChanged.
Dispose void Disposes the component and releases resources.
FocusAsync ValueTask bool containedInScrollableList Sets focus to the component's element.
Name Typ Default Description
Name string Required unique identifier for the component within its container.
Visible bool true Determines if the component is visible in the UI.
Disabled bool false Disables the form control, ensuring it doesn't participate in form submission.
ComponentNameSpace string The namespace for permission-based access control.
PermissionKey string? null A stable key that takes the place of Name in the generated permission namespace (Page.PermissionKey): the stored permission survives a rename, and components that share a key share one permission entry. Null: keyed by Name. Read once, when the component registers; an explicit ComponentNameSpace wins.
Class string Optional CSS class names.
Style string Optional in-line styles.
Tag object An optional user-defined object to store any additional data with the component.
BackReference DwsReference A reference to the enclosing component.
ID string The HTML ID attribute for the component.
AdditionalAttributes Dictionary<string, object> Additional HTML attributes for the component's root element.
IgnorePermissionChecks bool false Bypasses all permission checks for this component.
IgnorePermissionSelection bool false Ignore permission selection mode for this component.
IgnoreFormBusy bool false Takes the component out of the submit lock of the DwsForm (or DwsFormBusyRegion) around it: IsFormBusy stays false for it.
Name Typ Description
OnInitializedCallbackStarted EventCallback Callback when OnInitialized starts.
OnInitializedCallback EventCallback Callback during OnInitialized.
OnInitializedCallbackCompleted EventCallback Callback when OnInitialized completes.
OnInitializedAsyncCallbackStarted EventCallback Callback when OnInitializedAsync starts.
OnInitializedAsyncCallback EventCallback Callback during OnInitializedAsync.
OnInitializedAsyncCallbackCompleted EventCallback Callback when OnInitializedAsync completes.
OnIsComponentLoadingChanged EventCallback<bool> Callback when IsComponentLoading changes.
OnCurrentRenderModeChanged EventCallback<DwsRenderMode> Callback when CurrentRenderMode changes.
OnComponentStateChanged EventCallback<DwsComponentStateType> Callback when ComponentState changes.
An error has occurred. This app may no longer respond until reloaded.