PM
Size: a a a
PM
КС
КС
PM
КС
<script>
export let value = '';
export let desc = '';
export let label = true;
export let margin = true;
</script>
{#if label}
<label class="input" class:margin>
<span>{desc}</span
><input type="text" bind:value on:input />
</label>
{:else}
<input
class="input"
class:margin
type="text"
placeholder={desc}
bind:value
on:input
/>
{/if}
<style lang="scss">
.input {
display: block;
}
input {
@include input;
}
* + .margin {
margin-top: pxrem(8);
}
</style>
PM
КС
PM
<script>
export let value = '';
export let desc = '';
export let label = true;
export let margin = true;
</script>
{#if label}
<label class="input" class:margin>
<span>{desc}</span
><input type="text" bind:value on:input />
</label>
{:else}
<input
class="input"
class:margin
type="text"
placeholder={desc}
bind:value
on:input
/>
{/if}
<style lang="scss">
.input {
display: block;
}
input {
@include input;
}
* + .margin {
margin-top: pxrem(8);
}
</style>
PM
КС
<script>
export let checked = false;
export let desc = '';
export let margin = true;
</script>
<label class="checkbox {$$restProps.class || ''}" class:margin>
<input type="checkbox" bind:checked on:change on:click><span>{desc}</span>
</label>
<style lang="scss">
label {
display: block;
position: relative;
}
* + label.margin {
margin-top: pxrem(8);
}
input {
position: absolute;
z-index: -1;
opacity: 0;
}
input:checked + span {
color: hsl(90, 60%, 35%);
}
input:checked + span::before {
background: hsl(90, 60%, 55%);
}
input:checked + span::after {
left: pxrem(19);
}
span {
padding-left: pxrem(40);
transition: 0.2s;
}
span::before, span::after {
content: '';
position: absolute;
display: inline-block;
}
span::before {
top: pxrem(3);
left: 0;
width: pxrem(36);
height: pxrem(18);
border-radius: pxrem(12);
background: #ccc;
// box-shadow: inset 0 pxrem(1) pxrem(1) #0004;
transition: 0.2s;
}
span::after {
top: pxrem(4);
left: pxrem(1);
width: pxrem(16);
height: pxrem(16);
border-radius: 50%;
background: #fff;
// box-shadow: 0 pxrem(1) pxrem(1) #0003;
transition: 0.2s;
}
</style>
КС
КС
КС
PM
КС
КС
КС
PM
КС