Number Input Custom Buttons
Replace the step button icons and change the buttons layout. SVGs in the decrement-icon and increment-icon slots replace the icons, and the field and button parts move the buttons.
Code
The following example assumes that you have imported the component and set up the theme.
<div class="number-input-custom-buttons">41 collapsed lines
<div class="variant"> <label for="number-input-quantity">Quantity</label> <sv-number-input id="number-input-quantity" class="side-buttons" min="0" suffix=" pcs" value="1" > <!-- Minus --> <svg aria-hidden="true" slot="decrement-icon" viewBox="0 0 24 24"> <path d="M5 11h14v2H5z"></path> </svg>
<!-- Plus --> <svg aria-hidden="true" slot="increment-icon" viewBox="0 0 24 24"> <path d="M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z"></path> </svg> </sv-number-input> </div>
<div class="variant"> <label for="number-input-font-size">Font size</label> <sv-number-input id="number-input-font-size" class="stacked-buttons" min="8" suffix=" px" value="16" > <!-- Down triangle --> <svg aria-hidden="true" slot="decrement-icon" viewBox="0 0 24 24"> <path d="M6 9h12l-6 7z"></path> </svg>
<!-- Up triangle --> <svg aria-hidden="true" slot="increment-icon" viewBox="0 0 24 24"> <path d="M6 15h12l-6-7z"></path> </svg> </sv-number-input> </div></div>
<style>55 collapsed lines
.number-input-custom-buttons { display: grid; gap: 1.5em; justify-items: center;
.variant { display: grid; gap: 0.5em; justify-items: center; }
sv-number-input { inline-size: 12em; }
svg { inline-size: 1.25em; block-size: 1.25em; fill: currentcolor; }
.side-buttons { &::part(input) { text-align: center; }
&::part(decrement-button) { order: -1; border-inline-start: none; border-inline-end: inherit; } }
.stacked-buttons { &::part(field) { display: grid; grid-template-columns: 1fr auto; }
&::part(input) { grid-row: span 2; inline-size: 100%; block-size: 2.75em; }
&::part(increment-button) { grid-area: 1 / 2; }
&::part(decrement-button) { grid-area: 2 / 2; border-block-start: inherit; } } }</style>