diff --git a/src/elements/form-field/form-field/form-field.scss b/src/elements/form-field/form-field/form-field.scss
index f02608a5d1..62c6dd5f8b 100644
--- a/src/elements/form-field/form-field/form-field.scss
+++ b/src/elements/form-field/form-field/form-field.scss
@@ -388,7 +388,14 @@
.sbb-form-field__input {
display: flex;
- :host([size='s']:is([data-input-type='input'], [data-input-type='select'])) & {
+ :host(
+ [size='s']:is(
+ [data-input-type='input'],
+ [data-input-type='select'],
+ [data-input-type='sbb-select']
+ )
+ )
+ & {
// In size s, the natural height of the text input is too small.
// To not reserve too much space, we decrease the height.
margin-block-end: #{sbb.px-to-rem-build(-2)};
diff --git a/src/elements/select/readme.md b/src/elements/select/readme.md
index 17bc9967d6..5b8adff8a3 100644
--- a/src/elements/select/readme.md
+++ b/src/elements/select/readme.md
@@ -70,6 +70,18 @@ the selected values will be displayed in selection order, separated by a comma.
```
+## Style
+
+The component has no `size` property but, when slotted in a `sbb-form-field`,
+the height of the panel's trigger adapts based on the parent `size` property.
+
+```html
+
+
+ ...
+
+```
+
## Events
Consumers can listen to the native `change`/`input` event on the `sbb-select` component to intercept the selection's change;
diff --git a/src/elements/select/select.stories.ts b/src/elements/select/select.stories.ts
index ff6dca943d..3eb1c74385 100644
--- a/src/elements/select/select.stories.ts
+++ b/src/elements/select/select.stories.ts
@@ -49,6 +49,16 @@ const borderless: InputType = {
},
};
+const size: InputType = {
+ control: {
+ type: 'inline-radio',
+ },
+ options: ['m', 's'],
+ table: {
+ category: 'Form-field',
+ },
+};
+
const negative: InputType = {
control: {
type: 'boolean',
@@ -160,6 +170,7 @@ const disableGroup: InputType = {
const defaultArgTypes: ArgTypes = {
borderless,
+ size,
negative,
floatingLabel,
value,
@@ -176,6 +187,7 @@ const defaultArgTypes: ArgTypes = {
const defaultArgs: Args = {
borderless: false,
+ size: size.options![0],
negative: false,
floatingLabel: false,
value: undefined,
@@ -280,6 +292,7 @@ const createOptionsGroup = (
const FormFieldTemplate = ({
borderless,
+ size,
negative,
floatingLabel,
numberOfOptions,
@@ -291,6 +304,7 @@ const FormFieldTemplate = ({
html`
{
const valueEllipsis: string = 'This label name is so long that it needs ellipsis to fit.';
const defaultArgs = {
borderless: false,
+ size: 'm',
negative: false,
disableOption: false,
withOptionGroup: false,
@@ -53,6 +54,7 @@ describe('sbb-select', () => {
const template = ({
borderless,
+ size,
negative,
disableOption,
withOptionGroup,
@@ -64,7 +66,7 @@ describe('sbb-select', () => {
args.value = [args.value as string];
}
return html`
-
+
{
}),
);
+ it(
+ `negative=${negative} multiple=${multiple} size=s`,
+ visualDiffDefault.with(async (setup) => {
+ await setup.withFixture(template({ ...defaultArgs, negative, multiple, size: 's' }), {
+ minHeight: '600px',
+ backgroundColor: negative ? 'var(--sbb-color-black)' : undefined,
+ });
+ setup.withPostSetupAction(() => {
+ const select = setup.snapshotElement.querySelector('sbb-select')!;
+ select.open();
+ });
+ }),
+ );
+
it(
`negative=${negative} multiple=${multiple} disableOption=true`,
visualDiffDefault.with(async (setup) => {