Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d86e8ac
feat(label-group): add new label-group-element
Sep 11, 2025
7f82f28
chore(label-group): minor updates
Oct 20, 2025
9b251d6
feat(label-group): add new functions and features for label management
Oct 26, 2025
8514436
chore: add changeset for pf-label-group element
Oct 27, 2025
8e3236a
docs(label-group): add demos for closeable,overflow,vertical,header o…
Oct 27, 2025
751df4c
fix: correct config path
Oct 28, 2025
5528dd3
chore: small fixes after review
Oct 28, 2025
72c0833
chore: push current state for debugging build errors
Nov 2, 2025
64688ae
chore(label-group): resolve merge conflicts and update package-lock.json
Nov 3, 2025
616b18d
chore(label-group): fix errors
Nov 4, 2025
12c0d2a
chore(label-group): resolve patch conflict keeping upstream version
Nov 4, 2025
bc5f6c9
chore(label-group): resolve patch conflict keeping upstream version
Nov 4, 2025
5c721a7
docs(label-group): update changeset to follow changelog format
Nov 5, 2025
e211096
chore(label-group): fix whitespace and formatting in demos
Nov 5, 2025
89c762f
Revert changes to package-lock.json per PR review
Nov 5, 2025
16212ee
fix(label-group): make collapsedText placeholder generic
Nov 5, 2025
141781e
fix(label-group): wrap #labels getter with server check to avoid DOM …
Nov 5, 2025
9f82c0b
fix(label-group): wrap #labels getter with server check to avoid DOM …
Nov 5, 2025
fb079ed
fix(label-group): guard DOM access for SSR
Nov 5, 2025
06ada58
docs: update README with latest instructions
Nov 6, 2025
7348fd0
chore(label-group): update pf-label-group.ts
Nov 6, 2025
37a1cb6
feat(label-group): add Functionality
Nov 13, 2025
0dcec75
chore(label-group): apply the reqeasted changes
Nov 16, 2025
2eeae64
feat(label-group): add demo to add label
Michal7290 Nov 19, 2025
626f9f2
Merge remote-tracking branch 'sara/create-pf-lable-group' into create…
Michal7290 Nov 19, 2025
8cfa3ef
feat(label-group): change the demos
Michal7290 Nov 20, 2025
b00fa46
Merge pull request #1 from Michal7290/create-pf-lable-group
saraDahanCode Nov 20, 2025
cffdff2
chore(label-group): transferring the insertion logic from TS to Demos
Nov 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/yummy-eagles-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
"@patternfly/elements": minor
---

✨ Added `<pf-label-group>`.


A label group displays multiple labels together, helping users visualize related categories, filters, or items.
Each label can be removed individually, and the entire group can also be cleared at once.
The element automatically handles overflow for long lists of labels and supports both horizontal and vertical layouts.

Use this when you need to show multiple tags, filters, or categorized items that users can remove, add, or adjust dynamically.
Avoid using it for single, standalone labels — consider using `<pf-label>` instead.

```html
<pf-label-group label="Filters" add-label-mode="fromList">
<pf-label removable>Security</pf-label>
<pf-label removable>Performance</pf-label>
<pf-label removable>Networking</pf-label>
</pf-label-group>
```
1 change: 1 addition & 0 deletions elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"./pf-jump-links/pf-jump-links-item.js": "./pf-jump-links/pf-jump-links-item.js",
"./pf-jump-links/pf-jump-links-list.js": "./pf-jump-links/pf-jump-links-list.js",
"./pf-jump-links/pf-jump-links.js": "./pf-jump-links/pf-jump-links.js",
"./pf-label-group/pf-label-group.js": "./pf-label-group/pf-label-group.js",
"./pf-label/pf-label.js": "./pf-label/pf-label.js",
"./pf-select/pf-select.js": "./pf-select/pf-select.js",
"./pf-select/pf-listbox.js": "./pf-select/pf-listbox.js",
Expand Down
62 changes: 62 additions & 0 deletions elements/pf-label-group/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Label Group
A label group is a collection of labels that can be grouped by category and used to represent one or more values assigned to a single attribute.
When the number of labels exceeds `numLabels`, additional labels are hidden under an overflow label.

## Installation

Load `<pf-label-group>` via CDN:

```html
<script src="https://jspm.dev/@patternfly/elements/pf-label-group/pf-label-group.js"></script>
```

Or, if you are using [NPM](https://npm.im), install it

```bash
npm install @patternfly/elements
```

Then once installed, import it to your application:

```js
import '@patternfly/elements/pf-label-group/pf-label-group.js';
```

---

## Usage

```html
<pf-label-group num-labels="2">
<span slot="category">Fruit Types</span>
<pf-label>Apple</pf-label>
<pf-label>Banana</pf-label>
<pf-label>Orange</pf-label>
</pf-label-group>
```

Displays a group of labels, showing only the first two and an overflow label like “1 more” that expands on click.

## Adding Labels

`<pf-label-group>` supports adding new labels dynamically through the `addLabelMode` attribute:

- `none` (default): No label addition.
- `autoNoEdit`: Adds labels automatically without user editing.
- `fromList`: Allows adding labels from a predefined list.
- `customForm`: Lets users add custom labels via a form.

Example:

```html
<pf-label-group add-label-mode="fromList">
<span slot="category">Filters</span>
<pf-label removable>Security</pf-label>
<pf-label removable>Performance</pf-label>
</pf-label-group>

Use this feature when you want users to dynamically add new tags or filters to the group.

---


11 changes: 11 additions & 0 deletions elements/pf-label-group/demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<pf-label-group open>
<pf-label color="blue">Blue Label</pf-label>
<pf-label color="green">Green Label</pf-label>
<pf-label color="orange">Orange Label</pf-label>
</pf-label-group>

<script type="module">
import '@patternfly/elements/pf-label-group/pf-label-group.js';
import '@patternfly/elements/pf-label/pf-label.js';
import '@patternfly/elements/pf-button/pf-button.js';
</script>
38 changes: 38 additions & 0 deletions elements/pf-label-group/demo/label-group-add-label-auto.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<pf-label-group id="label-group" closeable>
<h2 slot="category">group name</h2>
<pf-label color="red" icon="info-circle" removable>label-1</pf-label>
<pf-label color="green" icon="info-circle" removable>label-2</pf-label>
<pf-label color="blue" icon="info-circle" removable>label-3</pf-label>

<pf-label id="add-button" color="blue" variant="outline" dismissible="false" >
Add label </pf-label>
</pf-label-group>


<script type="module">
import '@patternfly/elements/pf-label-group/pf-label-group.js';
import '@patternfly/elements/pf-label/pf-label.js';
import '@patternfly/elements/pf-button/pf-button.js';
import '@patternfly/elements/pf-modal/pf-modal.js';
import '@patternfly/elements/pf-dropdown/pf-dropdown.js';
document.getElementById('add-button').addEventListener('click', () => {
const labelGroup = document.getElementById('label-group');
const newLabel = document.createElement('pf-label');
newLabel.setAttribute('color', 'grey');
newLabel.setAttribute('icon', 'info-circle');
newLabel.setAttribute('removable', 'true');
newLabel.textContent = `new-label`;
const firstLabel = labelGroup.querySelector('pf-label:not([slot])');
if (firstLabel) labelGroup.insertBefore(newLabel, firstLabel);
else labelGroup.appendChild(newLabel);
});
</script>
<style>
#add-button {
cursor: pointer;
align-items: center;
gap: 4px;
transition: border 0.2s ease;
border-radius: 0.99rem;
}
</style>
Loading
Loading