diff --git a/components/select/src/vwc-select.scss b/components/select/src/vwc-select.scss
index 3f05d934d..335f70986 100644
--- a/components/select/src/vwc-select.scss
+++ b/components/select/src/vwc-select.scss
@@ -205,3 +205,15 @@ vwc-notched-outline {
pill: 24px,
)
);
+
+:host([ghost][dense]) {
+ .mdc-select .mdc-floating-label {
+ left: 0;
+ }
+ vwc-notched-outline {
+ --mdc-notched-outline-stroke-width: 0;
+ }
+ .mdc-select__anchor {
+ display: block;
+ }
+}
diff --git a/components/select/src/vwc-select.ts b/components/select/src/vwc-select.ts
index 6df97be35..9e6428027 100644
--- a/components/select/src/vwc-select.ts
+++ b/components/select/src/vwc-select.ts
@@ -48,6 +48,9 @@ export class VWCSelect extends MWCSelect {
@property({ type: String, reflect: true })
name: string | undefined;
+ @property({ type: Boolean, reflect: true, attribute: 'ghost' })
+ ghost = false;
+
override connectedCallback(): void {
super.connectedCallback();
if (!this.hasAttribute('outlined')) {
@@ -64,7 +67,7 @@ export class VWCSelect extends MWCSelect {
protected override update(changedProperties: PropertyValues): void {
super.update(changedProperties);
- if (this.shape === 'pill') {
+ if (this.shape === 'pill' || this.ghost) {
this.dense = true;
}
}
diff --git a/components/select/stories/arg-types.js b/components/select/stories/arg-types.js
index bf0040af4..faae4706d 100644
--- a/components/select/stories/arg-types.js
+++ b/components/select/stories/arg-types.js
@@ -28,6 +28,12 @@ export const argTypes = {
options: { true: '', false: undefined },
},
},
+ ghost: {
+ control: {
+ type: 'inline-radio',
+ options: { true: '', false: undefined },
+ },
+ },
form: { table: { disable: true } },
outlined: { table: { disable: true } },
outlineOpen: { table: { disable: true } },
diff --git a/components/select/stories/select.stories.js b/components/select/stories/select.stories.js
index eee6c1152..d9f5190a5 100644
--- a/components/select/stories/select.stories.js
+++ b/components/select/stories/select.stories.js
@@ -36,6 +36,9 @@ DenseNoLabel.args = { dense: '' };
export const PillAutoDense = Template.bind({});
PillAutoDense.args = { shape: 'pill', label: 'VWC Select' };
+export const GhostLayoutAutoDense = Template.bind({});
+GhostLayoutAutoDense.args = { ghost: '', label: 'VWC Select' };
+
export const Disabled = Template.bind({});
Disabled.args = { disabled: '', label: 'VWC Select', helper: 'Helper Text' };
diff --git a/components/select/test/select.test.js b/components/select/test/select.test.js
index 011b5c09b..72901ede2 100644
--- a/components/select/test/select.test.js
+++ b/components/select/test/select.test.js
@@ -15,7 +15,7 @@ import {
import {
shapeRoundedTestCases,
shapePillTestCases,
-} from '../../../test/shared.js';
+} from '../../../test/shared/shape.test.js';
import {
assertDenseStyles,
hasNotchedOutline,
@@ -468,4 +468,27 @@ describe('select', () => {
expect(endTime - startTime).to.be.lessThan(50);
});
});
+
+ describe(`ghost`, function () {
+ it(`should set dense to true if ghost is set`, async function () {
+ const [select] = addElement(
+ textToDomToParent(`
+ <${COMPONENT_NAME}>
+
Dense-with label
+Dense-no label
+