Tag Input¶
A tag/chip input widget for entering and managing multiple tags.
Preview
Classes¶
FXTagInput
¶
Bases: ,
A styled input widget that displays tags as removable chips.
This widget provides an input field where users can type and press Enter to add tags. Tags are displayed as styled chips that can be removed by clicking the × button.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
Parent widget. |
None
|
|
|
Placeholder text for the input field. |
'Add tag and press Enter...'
|
|
|
Maximum number of tags allowed (0 = unlimited). |
0
|
|
|
Whether duplicate tags are allowed. |
False
|
Signals
tags_changed: Emitted when tags are added or removed. tag_added: Emitted when a single tag is added. tag_removed: Emitted when a single tag is removed.
Examples:
>>> tag_input = FXTagInput(placeholder="Add tags...")
>>> tag_input.tags_changed.connect(lambda tags: print(f"Tags: {tags}"))
>>> tag_input.add_tag("python")
>>> tag_input.add_tag("qt")
Methods:
| Name | Description |
|---|---|
|
Add a tag to the input. |
|
Remove all tags. |
|
Remove a tag from the input. |
|
Set the tags, replacing any existing tags. |
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Return the list of current tags. |
add_tag
¶
Add a tag to the input.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The tag text to add. |
required |
Returns:
| Type | Description |
|---|---|
|
True if the tag was added, False otherwise. |
FXTagChip
¶
Bases: ,
A single removable tag chip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
The tag text. |
required |
|
|
Parent widget. |
None
|
|
|
Whether the chip can be removed. |
True
|
Signals
removed: Emitted when the remove button is clicked.
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
Return the tag text. |