Skip to content

Commit 3a86f01

Browse files
authored
fix: Add whitespace when appending/prepending icon in uui-input (#408)
* alignment and whitespace * fix padding in append example
1 parent 61e6716 commit 3a86f01

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export class UUIIconElement extends LitElement {
2626
::slotted(svg) {
2727
fill: var(--uui-icon-color, currentColor);
2828
}
29+
30+
:host-context(div[slot='prepend']) {
31+
margin-left: var(--uui-size-2, 6px);
32+
}
33+
34+
:host-context(div[slot='append']) {
35+
margin-right: var(--uui-size-2, 6px);
36+
}
2937
`,
3038
];
3139

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,42 @@ export const PrependAndAppend: Story = props =>
138138
</uui-input>
139139
`;
140140

141+
export const PrependIcon: Story = props =>
142+
html` <uui-input
143+
.disabled=${props.disabled}
144+
.readonly=${props.readonly}
145+
.error=${props.error}
146+
.label=${props.label}
147+
.type=${props.type}
148+
.name=${props.name}
149+
.placeholder=${props.placeholder}
150+
.value=${props.value}>
151+
<div slot="prepend">
152+
<uui-icon-registry-essential>
153+
<uui-icon name="search"></uui-icon>
154+
</uui-icon-registry-essential>
155+
</div>
156+
</uui-input>`;
157+
158+
export const AppendIcon: Story = props =>
159+
html` <uui-input
160+
.disabled=${props.disabled}
161+
.readonly=${props.readonly}
162+
.error=${props.error}
163+
.label=${props.label}
164+
.type=${props.type}
165+
.name=${props.name}
166+
.placeholder=${props.placeholder}
167+
.value=${props.value}>
168+
<div
169+
slot="append"
170+
style="background:#f3f3f3; padding-left:var(--uui-size-2, 6px)">
171+
<uui-icon-registry-essential>
172+
<uui-icon name="delete"></uui-icon>
173+
</uui-icon-registry-essential>
174+
</div>
175+
</uui-input>`;
176+
141177
export const MultipleInputs: Story = props =>
142178
html`
143179
<uui-input

0 commit comments

Comments
 (0)