Skip to content

Commit 86aa89b

Browse files
authored
Fix TagGroup label alignment (#4102)
1 parent 3f3e83f commit 86aa89b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/@adobe/spectrum-css-temp/components/tags/index.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ governing permissions and limitations under the License.
2020
display: inline;
2121
}
2222

23+
.spectrum-Tags-container {
24+
/* Aligns tags with label. */
25+
margin-inline-start: calc(calc(var(--spectrum-taggroup-tag-gap-x) / 2) * -1);
26+
margin-inline-end: calc(var(--spectrum-taggroup-tag-gap-x) / 2);
27+
}
28+
2329
.spectrum-Tags-item {
2430
@inherit: %spectrum-FocusRing;
2531
--spectrum-focus-ring-border-radius: var(--spectrum-tag-border-radius);

packages/@react-spectrum/tag/src/TagGroup.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
156156
errorMessageProps={errorMessageProps}
157157
showErrorIcon
158158
ref={domRef}
159+
elementType="span"
159160
UNSAFE_className={
160161
classNames(
161162
styles,
@@ -166,7 +167,8 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
166167
)
167168
}>
168169
<div
169-
ref={containerRef}>
170+
ref={containerRef}
171+
className={classNames(styles, 'spectrum-Tags-container')}>
170172
<div
171173
ref={tagsRef}
172174
{...tagGroupProps}

0 commit comments

Comments
 (0)