Control input dimensions and typography with preset sizes, custom fonts, and REM-based scaling
The --ms-rem
CSS variable (default: 10px) controls the base unit for all dimensions. Change it to scale the entire component proportionally.
<!-- Scale entire component by changing --ms-rem -->
<web-multiselect style="--ms-rem: 8px;"></web-multiselect> <!-- 80% size -->
<web-multiselect style="--ms-rem: 12px;"></web-multiselect> <!-- 120% size -->
<!-- Or via CSS class -->
<style>
web-multiselect.compact { --ms-rem: 8px; }
web-multiselect.large { --ms-rem: 15px; }
</style>
Override individual CSS variables for precise control over specific dimensions.
<style>
#my-multiselect {
--ms-input-font-size: 18px;
--ms-input-padding: 12px 16px;
--ms-option-title-font-size: 16px;
}
</style>
For dense forms where input space is limited: show just a code in the input, but use dropdown-min-width
to ensure the dropdown is comfortable for selection.
<!-- Narrow input with wide dropdown -->
<web-multiselect
style="width: 4rem;"
dropdown-min-width="20rem"
multiple="false">
</web-multiselect>
<script>
// Show just the code in the closed input
select.renderSelectedContentCallback = (item) => item.code;
// Show full label in dropdown
select.getDisplayValueCallback = (item) => `${item.flag} ${item.name}`;
</script>
All component parts (badges, options, checkboxes) scale together.
--ms-rem: 8px
--ms-rem: 10px
--ms-rem: 12px
--ms-rem: 15px
Set --base-font-family
on the element to change the font. Works with any CSS font stack.
--base-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif
--base-font-family: "Inter", sans-serif
--base-font-family: "Montserrat", sans-serif
--base-font-family: "Quicksand", sans-serif
--base-font-family: "Lexend", sans-serif
--base-font-family: "Fira Code", monospace
Important variables for sizing and typography:
| Variable | Default | Description |
|---|---|---|
--ms-rem |
10px | Base unit - scales everything proportionally |
--ms-input-font-size |
calc(1.4 * var(--ms-rem)) | Input text size (14px default) |
--ms-input-padding |
calc(0.8 * var(--ms-rem)) calc(1.2 * var(--ms-rem)) | Input padding |
--ms-option-title-font-size |
calc(1.4 * var(--ms-rem)) | Option text size |
--ms-badge-font-size |
calc(1.2 * var(--ms-rem)) | Badge text size |
Note:
CSS variables must be set on the <web-multiselect>
element itself (or via inherited CSS), not on wrapper divs, due to Shadow DOM encapsulation.
All typography variables with their theme-designer integration:
| Variable | Default | Theme Designer Source |
|---|---|---|
--ms-font-size-2xs |
10px | --base-font-size-2xs |
--ms-font-size-xs |
12px | --base-font-size-xs |
--ms-font-size-sm |
14px | --base-font-size-sm |
--ms-font-size-base |
16px | --base-font-size-base |
--ms-font-size-lg |
18px | --base-font-size-lg |
--ms-font-weight-normal |
400 | --base-font-weight-normal |
--ms-font-weight-medium |
500 | --base-font-weight-medium |
--ms-font-weight-semibold |
600 | --base-font-weight-semibold |
--ms-line-height-tight |
1.25 | --base-line-height-tight |
--ms-line-height-normal |
1.5 | --base-line-height-normal |
--ms-line-height-relaxed |
1.75 | --base-line-height-relaxed |