Skip to content

Commit 872a8ad

Browse files
committed
ui-tag sizing
1 parent f2a85bd commit 872a8ad

File tree

2 files changed

+32
-40
lines changed

2 files changed

+32
-40
lines changed

packages/uui-tag/lib/uui-tag.element.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@ import {
66
} from '@umbraco-ui/uui-base/lib/types';
77

88
/**
9-
* Tag component from Umbraco UI components library. Comes in one shape, but different looks and sizes
9+
*
1010
* @element uui-tag
11+
* @description Tag component from Umbraco UI components library. Comes in one shape, but different looks and sizes
1112
* @slot - for tag contents
13+
* @cssprop --uui-tag-font-size - overwrite the default font-size for the tag.
1214
*/
1315
export class UUITagElement extends LitElement {
1416
static styles = [
1517
css`
1618
:host {
1719
display: inline-block;
18-
font-family: inherit;
20+
font-size: var(--uui-tag-font-size, var(--uui-type-small-size));
1921
font-weight: 700;
20-
line-height: 1.1; /* should have have another line height, lets check with multiple line tag. */
21-
/*font-size: var(--uui-tag-font-size, 0.9em);*/
22-
padding: 0.5em 1em;
23-
border-radius: 1000px;
22+
line-height: 1;
23+
padding: var(--uui-size-space-1) calc(var(--uui-size-space-1) + 0.5em);
24+
border-radius: 100px;
2425
background-color: var(--uui-interface-surface-alt);
2526
color: var(--uui-interface-contrast);
2627
user-select: none;
27-
transition: background-color 120ms, color 120ms;
2828
}
2929
3030
slot {
3131
display: flex;
3232
align-items: center;
33+
justify-content: center;
34+
margin: 2px;
3335
}
3436
3537
/* Looks */

packages/uui-tag/lib/uui-tag.story.ts

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ export default {
88
component: 'uui-tag',
99
id: 'uui-tag',
1010
args: {
11-
size: 'm',
1211
look: '',
1312
slot: 'Hello',
1413
},
1514
argTypes: {
16-
size: {
17-
options: ['xs', 's', 'm', 'l', 'xl'],
18-
},
1915
slot: { table: { category: 'slots' }, control: { type: 'text' } },
2016
look: {
2117
options: [
@@ -31,10 +27,9 @@ export default {
3127
},
3228
};
3329

34-
const Template: Story = props =>
35-
html`
36-
<uui-tag .look=${props.look} .size=${props.size}>${props.slot}</uui-tag>
37-
`;
30+
const Template: Story = props => html`
31+
<uui-tag .look=${props.look}>${props.slot}</uui-tag>
32+
`;
3833

3934
export const AAAOverview = Template.bind({});
4035
AAAOverview.storyName = 'Overview';
@@ -46,51 +41,46 @@ AAAOverview.parameters = {
4641
},
4742
};
4843

49-
export const Looks: Story = props =>
44+
export const Looks: Story = () =>
5045
html`
51-
<uui-tag .look=${props.look} .size=${props.size}>${props.slot}</uui-tag>
52-
<h5>Looks</h5>
5346
${InterfaceLookNames.map(
54-
look => html`<uui-tag size="m" look="${look}">${look}</uui-tag>`
47+
look => html`<uui-tag look="${look}">${look}</uui-tag><br />`
5548
)}
5649
`;
5750

5851
Looks.parameters = {
5952
docs: {
6053
source: {
6154
code: `
62-
<uui-tag size="m" look="primary">primary</uui-tag>
63-
<uui-tag size="m" look="secondary">secondary</uui-tag>
64-
<uui-tag size="m" look="outline">outline</uui-tag>
65-
<uui-tag size="m" look="placeholder">placeholder</uui-tag>
66-
<uui-tag size="m" look="positive">positive</uui-tag>
67-
<uui-tag size="m" look="warning">warning</uui-tag>
68-
<uui-tag size="m" look="danger">danger</uui-tag>
55+
<uui-tag look="primary">primary</uui-tag>
56+
<uui-tag look="secondary">secondary</uui-tag>
57+
<uui-tag look="outline">outline</uui-tag>
58+
<uui-tag look="placeholder">placeholder</uui-tag>
59+
<uui-tag look="positive">positive</uui-tag>
60+
<uui-tag look="warning">warning</uui-tag>
61+
<uui-tag look="danger">danger</uui-tag>
6962
`,
7063
},
7164
},
7265
};
7366

74-
export const Sizes: Story = props =>
67+
export const Sizing: Story = props =>
7568
html`
76-
<uui-tag .look=${props.look} .size=${props.size}>${props.slot}</uui-tag>
77-
<h5>Sizes</h5>
78-
<uui-tag size="xs" look="primary">extra small</uui-tag>
79-
<uui-tag size="s" look="primary">small</uui-tag>
80-
<uui-tag size="m" look="primary">medium</uui-tag>
81-
<uui-tag size="l" look="primary">large</uui-tag>
82-
<uui-tag size="xl" look="primary">extra large</uui-tag>
69+
<uui-tag style="font-size:9px;" .look=${props.look}>Extra small</uui-tag
70+
><br />
71+
<uui-tag style="font-size:12px;" .look=${props.look}>Default</uui-tag><br />
72+
<uui-tag style="font-size:15px;" .look=${props.look}>Medium</uui-tag><br />
73+
<uui-tag style="font-size:18px;" .look=${props.look}>Large</uui-tag>
8374
`;
8475

85-
Sizes.parameters = {
76+
Sizing.parameters = {
8677
docs: {
8778
source: {
8879
code: `
89-
<uui-tag size="xs">extra small</uui-tag>
90-
<uui-tag size="s">small</uui-tag>
91-
<uui-tag size="m">medium</uui-tag>
92-
<uui-tag size="l">large</uui-tag>
93-
<uui-tag size="xl">extra large</uui-tag>
80+
<uui-tag style="font-size:9px;" look="primary">Extra small</uui-tag>
81+
<uui-tag style="font-size:12px;" look="primary">Default</uui-tag>
82+
<uui-tag style="font-size:15px;" look="primary">Medium</uui-tag>
83+
<uui-tag style="font-size:18px;" look="primary">Large</uui-tag>
9484
`,
9585
},
9686
},

0 commit comments

Comments
 (0)