Class TwChip
- Namespace
- TwBlazor.Components
- Assembly
- TwBlazor.dll
Represents a chip component for displaying compact elements representing an input, attribute, or action.
public class TwChip : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
- Inheritance
-
TwChip
- Implements
- Inherited Members
Constructors
TwChip()
public TwChip()
Properties
Avatar
Gets or sets the avatar text/initials to display at the start of the chip.
[Parameter]
public string? Avatar { get; set; }
Property Value
Remarks
When set, this takes precedence over StartIcon.
ChildContent
Gets or sets the custom content to display in the chip.
[Parameter]
public RenderFragment? ChildContent { get; set; }
Property Value
Remarks
When provided, this content replaces the Label parameter.
Closable
Gets or sets whether the chip is closable (shows a close button).
[Parameter]
public bool Closable { get; set; }
Property Value
Remarks
Closable chips cannot be used with link chips (Href).
CloseIcon
Gets or sets the icon to use for the close button.
[Parameter]
public Icon CloseIcon { get; set; }
Property Value
Color
Gets or sets the color theme of the chip.
[Parameter]
public Color Color { get; set; }
Property Value
Disabled
Disables the chip if set to true.
[Parameter]
public bool Disabled { get; set; }
Property Value
EndIcon
Gets or sets whether to display an icon at the end of the chip.
[Parameter]
public Icon? EndIcon { get; set; }
Property Value
- Icon?
Href
Gets or sets the URL that the chip links to.
[Parameter]
public string Href { get; set; }
Property Value
Remarks
When set, the chip renders as a link. Link chips cannot use Closable or OnClick. If Target is set to "_blank", rel="noopener" will be added automatically unless a custom Rel is provided.
Label
Gets or sets the text label to display in the chip.
[Parameter]
public string Label { get; set; }
Property Value
OnClick
Gets or sets the callback that is invoked when the chip is clicked.
[Parameter]
public EventCallback OnClick { get; set; }
Property Value
Remarks
This callback is not invoked for link chips (when Href is set).
OnClose
Gets or sets the callback that is invoked when the close button is clicked.
[Parameter]
public EventCallback OnClose { get; set; }
Property Value
Rel
Gets or sets the relationship between the linked resource and the current document.
[Parameter]
public string? Rel { get; set; }
Property Value
Remarks
When not set and Target is "_blank", defaults to "noopener". This property overrides the automatic addition of rel="noopener".
Size
Gets or sets the size of the chip.
[Parameter]
public ChipSize Size { get; set; }
Property Value
StartIcon
Gets or sets whether to display an icon at the start of the chip.
[Parameter]
public Icon? StartIcon { get; set; }
Property Value
- Icon?
Target
Gets or sets the name of the target frame or window for the navigation request.
[Parameter]
public string Target { get; set; }
Property Value
Variant
Gets or sets the chip variant.
[Parameter]
public ButtonVariant Variant { get; set; }
Property Value
Remarks
Default is Filled.
Methods
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder