diff --git a/src/components/ha-control-select-menu.ts b/src/components/ha-control-select-menu.ts
index 028242488f..1984f50ffd 100644
--- a/src/components/ha-control-select-menu.ts
+++ b/src/components/ha-control-select-menu.ts
@@ -171,15 +171,12 @@ export class HaControlSelectMenu extends SelectBase {
--control-select-menu-background-color: var(--disabled-color);
--control-select-menu-background-opacity: 0.2;
--control-select-menu-border-radius: 14px;
- --control-select-menu-min-width: 120px;
- --control-select-menu-max-width: 200px;
- --control-select-menu-width: 100%;
--mdc-icon-size: 20px;
+ width: auto;
color: var(--primary-text-color);
-webkit-tap-highlight-color: transparent;
}
.select-anchor {
- color: var(--control-select-menu-text-color);
height: 48px;
padding: 6px 10px;
overflow: hidden;
@@ -198,11 +195,8 @@ export class HaControlSelectMenu extends SelectBase {
z-index: 0;
font-size: inherit;
transition: color 180ms ease-in-out;
- color: var(--control-text-icon-color);
gap: 10px;
- min-width: var(--control-select-menu-min-width);
- max-width: var(--control-select-menu-max-width);
- width: var(--control-select-menu-width);
+ width: 100%;
user-select: none;
font-size: 14px;
font-style: normal;
diff --git a/src/dialogs/more-info/components/ha-more-info-control-select-container.ts b/src/dialogs/more-info/components/ha-more-info-control-select-container.ts
new file mode 100644
index 0000000000..81edf2bbec
--- /dev/null
+++ b/src/dialogs/more-info/components/ha-more-info-control-select-container.ts
@@ -0,0 +1,79 @@
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
+import { customElement } from "lit/decorators";
+import { classMap } from "lit/directives/class-map";
+
+@customElement("ha-more-info-control-select-container")
+export class HaMoreInfoControlSelectContainer extends LitElement {
+ protected render(): TemplateResult {
+ const classname = `items-${this.childElementCount}`;
+
+ return html`
+
+ `;
+ }
+
+ static get styles(): CSSResultGroup {
+ return css`
+ .controls {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ }
+ .controls-scroll {
+ display: flex;
+ flex-direction: row;
+ justify-content: flex-start;
+ gap: 12px;
+ margin: auto;
+ overflow: auto;
+ -ms-overflow-style: none; /* IE and Edge */
+ scrollbar-width: none; /* Firefox */
+ margin: 0 -24px;
+ padding: 0 24px;
+ }
+ .controls-scroll::-webkit-scrollbar {
+ display: none;
+ }
+
+ ::slotted(*) {
+ min-width: 120px;
+ max-width: 160px;
+ flex: none;
+ }
+
+ @media all and (hover: hover),
+ all and (min-width: 600px) and (min-height: 501px) {
+ .controls-scroll {
+ justify-content: center;
+ flex-wrap: wrap;
+ width: 100%;
+ max-width: 450px;
+ }
+ .controls-scroll.items-4 {
+ max-width: 300px;
+ }
+ .controls-scroll.items-3 ::slotted(*) {
+ max-width: 140px;
+ }
+ .multiline ::slotted(*) {
+ width: 140px;
+ }
+ }
+ `;
+ }
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-more-info-control-select-container": HaMoreInfoControlSelectContainer;
+ }
+}
diff --git a/src/dialogs/more-info/components/ha-more-info-control-style.ts b/src/dialogs/more-info/components/ha-more-info-control-style.ts
index fb18016a28..19d8ae47a2 100644
--- a/src/dialogs/more-info/components/ha-more-info-control-style.ts
+++ b/src/dialogs/more-info/components/ha-more-info-control-style.ts
@@ -22,35 +22,6 @@ export const moreInfoControlStyle = css`
margin-bottom: 24px;
}
- .secondary-controls {
- display: flex;
- flex-direction: row;
- justify-content: center;
- }
- .secondary-controls-scroll {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- gap: 12px;
- margin: auto;
- overflow: auto;
- -ms-overflow-style: none; /* IE and Edge */
- scrollbar-width: none; /* Firefox */
- margin: 0 -24px;
- padding: 0 24px;
- }
- .secondary-controls-scroll::-webkit-scrollbar {
- display: none;
- }
-
- /* Don't use scroll on device without touch support */
- @media (hover: hover) {
- .secondary-controls-scroll {
- justify-content: center;
- flex-wrap: wrap;
- }
- }
-
.buttons {
display: flex;
align-items: center;
diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts
index 50f71dd212..3e3d4b10a4 100644
--- a/src/dialogs/more-info/controls/more-info-climate.ts
+++ b/src/dialogs/more-info/controls/more-info-climate.ts
@@ -38,6 +38,7 @@ import { haOscillating } from "../../../data/icons/haOscillating";
import { HomeAssistant } from "../../../types";
import "../components/climate/ha-more-info-climate-humidity";
import "../components/climate/ha-more-info-climate-temperature";
+import "../components/ha-more-info-control-select-container";
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
type MainControl = "temperature" | "humidity";
@@ -163,140 +164,135 @@ class MoreInfoClimate extends LitElement {
`
: nothing}
-
-
-
-
- ${stateObj.attributes.hvac_modes
- .concat()
- .sort(compareClimateHvacModes)
- .map(
- (mode) => html`
-
-
- ${this.hass.formatEntityState(stateObj, mode)}
-
- `
- )}
-
- ${supportPresetMode && stateObj.attributes.preset_modes
- ? html`
-
+
+
+
+ ${stateObj.attributes.hvac_modes
+ .concat()
+ .sort(compareClimateHvacModes)
+ .map(
+ (mode) => html`
+
- ${stateObj.attributes.preset_modes!.map(
- (mode) => html`
-
-
- ${this.hass.formatEntityAttributeValue(
- stateObj,
- "preset_mode",
- mode
- )}
-
- `
- )}
-
+ ${this.hass.formatEntityState(stateObj, mode)}
+
`
- : nothing}
- ${supportFanMode && stateObj.attributes.fan_modes
- ? html`
-
-
- ${stateObj.attributes.fan_modes!.map(
- (mode) => html`
-
-
- ${this.hass.formatEntityAttributeValue(
- stateObj,
- "fan_mode",
- mode
- )}
-
- `
- )}
-
- `
- : nothing}
- ${supportSwingMode && stateObj.attributes.swing_modes
- ? html`
-
-
- ${stateObj.attributes.swing_modes!.map(
- (mode) => html`
-
-
- ${this.hass.formatEntityAttributeValue(
- stateObj,
- "swing_mode",
- mode
- )}
-
- `
- )}
-
- `
- : nothing}
-
-
+ )}
+
+ ${supportPresetMode && stateObj.attributes.preset_modes
+ ? html`
+
+
+ ${stateObj.attributes.preset_modes!.map(
+ (mode) => html`
+
+
+ ${this.hass.formatEntityAttributeValue(
+ stateObj,
+ "preset_mode",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+ ${supportFanMode && stateObj.attributes.fan_modes
+ ? html`
+
+
+ ${stateObj.attributes.fan_modes!.map(
+ (mode) => html`
+
+
+ ${this.hass.formatEntityAttributeValue(
+ stateObj,
+ "fan_mode",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+ ${supportSwingMode && stateObj.attributes.swing_modes
+ ? html`
+
+
+ ${stateObj.attributes.swing_modes!.map(
+ (mode) => html`
+
+
+ ${this.hass.formatEntityAttributeValue(
+ stateObj,
+ "swing_mode",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+
`;
}
diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts
index b6e6901ebf..facbfe035f 100644
--- a/src/dialogs/more-info/controls/more-info-fan.ts
+++ b/src/dialogs/more-info/controls/more-info-fan.ts
@@ -27,6 +27,7 @@ import { haOscillating } from "../../../data/icons/haOscillating";
import { haOscillatingOff } from "../../../data/icons/haOscillatingOff";
import type { HomeAssistant } from "../../../types";
import "../components/fan/ha-more-info-fan-speed";
+import "../components/ha-more-info-control-select-container";
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
import "../components/ha-more-info-state-header";
import "../components/ha-more-info-toggle";
@@ -191,117 +192,112 @@ class MoreInfoFan extends LitElement {
`
: nothing}
-
-
- ${supportsPresetMode && this.stateObj.attributes.preset_modes
- ? html`
-
+
+ ${supportsPresetMode && this.stateObj.attributes.preset_modes
+ ? html`
+
+
+ ${this.stateObj.attributes.preset_modes?.map(
+ (mode) => html`
+
+ ${this.hass.formatEntityAttributeValue(
+ this.stateObj!,
+ "preset_mode",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+ ${supportsDirection
+ ? html`
+
+
+
- ${this.stateObj.attributes.preset_modes?.map(
- (mode) => html`
-
- ${this.hass.formatEntityAttributeValue(
- this.stateObj!,
- "preset_mode",
- mode
- )}
-
- `
- )}
-
- `
- : nothing}
- ${supportsDirection
- ? html`
-
-
-
-
- ${this.hass.formatEntityAttributeValue(
- this.stateObj,
- "direction",
- "forward"
- )}
-
-
-
- ${this.hass.formatEntityAttributeValue(
- this.stateObj,
- "direction",
- "reverse"
- )}
-
-
- `
- : nothing}
- ${supportsOscillate
- ? html`
-
+
+
+ ${this.hass.formatEntityAttributeValue(
+ this.stateObj,
+ "direction",
+ "reverse"
+ )}
+
+
+ `
+ : nothing}
+ ${supportsOscillate
+ ? html`
+
+
+
+
+ ${this.hass.localize("state.default.on")}
+
+
+
-
-
- ${this.hass.localize("state.default.on")}
-
-
-
- ${this.hass.localize("state.default.off")}
-
-
- `
- : nothing}
-
-
+ ${this.hass.localize("state.default.off")}
+
+
+ `
+ : nothing}
+
`;
}
diff --git a/src/dialogs/more-info/controls/more-info-humidifier.ts b/src/dialogs/more-info/controls/more-info-humidifier.ts
index 20c735e243..74754e25ad 100644
--- a/src/dialogs/more-info/controls/more-info-humidifier.ts
+++ b/src/dialogs/more-info/controls/more-info-humidifier.ts
@@ -25,6 +25,7 @@ import {
computeHumidiferModeIcon,
} from "../../../data/humidifier";
import { HomeAssistant } from "../../../types";
+import "../components/ha-more-info-control-select-container";
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
import "../components/humidifier/ha-more-info-humidifier-humidity";
@@ -91,79 +92,74 @@ class MoreInfoHumidifier extends LitElement {
>
-
-
-
-
-
- ${computeStateDisplay(
- this.hass.localize,
- this.stateObj,
- this.hass.locale,
- this.hass.config,
- this.hass.entities,
- "off"
- )}
-
-
- ${computeStateDisplay(
- this.hass.localize,
- this.stateObj,
- this.hass.locale,
- this.hass.config,
- this.hass.entities,
- "on"
- )}
-
-
+
+
+
+
+ ${computeStateDisplay(
+ this.hass.localize,
+ this.stateObj,
+ this.hass.locale,
+ this.hass.config,
+ this.hass.entities,
+ "off"
+ )}
+
+
+ ${computeStateDisplay(
+ this.hass.localize,
+ this.stateObj,
+ this.hass.locale,
+ this.hass.config,
+ this.hass.entities,
+ "on"
+ )}
+
+
- ${supportModes
- ? html`
-
-
- ${stateObj.attributes.available_modes!.map(
- (mode) => html`
-
-
- ${computeAttributeValueDisplay(
- hass.localize,
- stateObj!,
- hass.locale,
- hass.config,
- hass.entities,
- "mode",
- mode
- )}
-
- `
- )}
-
- `
- : nothing}
-
-
+ ${supportModes
+ ? html`
+
+
+ ${stateObj.attributes.available_modes!.map(
+ (mode) => html`
+
+
+ ${computeAttributeValueDisplay(
+ hass.localize,
+ stateObj!,
+ hass.locale,
+ hass.config,
+ hass.entities,
+ "mode",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+
`;
}
diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts
index 67ee73827d..5d3800d651 100644
--- a/src/dialogs/more-info/controls/more-info-light.ts
+++ b/src/dialogs/more-info/controls/more-info-light.ts
@@ -36,6 +36,7 @@ import {
lightSupportsFavoriteColors,
} from "../../../data/light";
import type { HomeAssistant } from "../../../types";
+import "../components/ha-more-info-control-select-container";
import { moreInfoControlStyle } from "../components/ha-more-info-control-style";
import "../components/ha-more-info-state-header";
import "../components/ha-more-info-toggle";
@@ -286,39 +287,37 @@ class MoreInfoLight extends LitElement {
: nothing}
-
-
- ${supportsEffects && this.stateObj.attributes.effect_list
- ? html`
-
-
- ${this.stateObj.attributes.effect_list?.map(
- (mode) => html`
-
- ${this.hass.formatEntityAttributeValue(
- this.stateObj!,
- "effect",
- mode
- )}
-
- `
- )}
-
- `
- : nothing}
-
-
+
+ ${supportsEffects && this.stateObj.attributes.effect_list
+ ? html`
+
+
+ ${this.stateObj.attributes.effect_list?.map(
+ (mode) => html`
+
+ ${this.hass.formatEntityAttributeValue(
+ this.stateObj!,
+ "effect",
+ mode
+ )}
+
+ `
+ )}
+
+ `
+ : nothing}
+
-
-
- ${supportOperationMode && stateObj.attributes.operation_list
- ? html`
-
+ ${supportOperationMode && stateObj.attributes.operation_list
+ ? html`
+
+
+ ${stateObj.attributes.operation_list
+ .concat()
+ .sort(compareWaterHeaterOperationMode)
+ .map(
+ (mode) => html`
+
+
+ ${this.hass.formatEntityState(stateObj, mode)}
+
+ `
)}
- .value=${stateObj.state}
- .disabled=${stateObj.state === UNAVAILABLE}
- fixedMenuPosition
- naturalMenuWidth
- @selected=${this._handleOperationModeChanged}
- @closed=${stopPropagation}
- >
+
+ `
+ : nothing}
+ ${supportAwayMode
+ ? html`
+
+
+
- ${stateObj.attributes.operation_list
- .concat()
- .sort(compareWaterHeaterOperationMode)
- .map(
- (mode) => html`
-
-
- ${this.hass.formatEntityState(stateObj, mode)}
-
- `
- )}
-
- `
- : nothing}
- ${supportAwayMode
- ? html`
-
-
-
-
- ${this.hass.localize("state.default.on")}
-
-
-
- ${this.hass.localize("state.default.off")}
-
-
- `
- : nothing}
-
-
+ ${this.hass.localize("state.default.on")}
+
+
+
+ ${this.hass.localize("state.default.off")}
+
+
+ `
+ : nothing}
+
`;
}