Skip to content

Commit

Permalink
Option to hide create box on todo card (#23571)
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored Jan 6, 2025
1 parent 334c87b commit e9f3f71
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/panels/lovelace/cards/hui-todo-list-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,10 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
"has-header": "title" in this._config,
})}
>
<div class="addRow">
${this._todoListSupportsFeature(
TodoListEntityFeature.CREATE_TODO_ITEM
)
? html`
${!this._config.hide_create &&
this._todoListSupportsFeature(TodoListEntityFeature.CREATE_TODO_ITEM)
? html`
<div class="addRow">
<ha-textfield
class="addBox"
.placeholder=${this.hass!.localize(
Expand All @@ -218,9 +217,9 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
@click=${this._addItem}
>
</ha-icon-button>
`
: nothing}
</div>
</div>
`
: nothing}
<ha-sortable
handle-selector="ha-svg-icon"
draggable-selector=".draggable"
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/cards/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ export interface TodoListCardConfig extends LovelaceCardConfig {
theme?: string;
entity?: string;
hide_completed?: boolean;
hide_create?: boolean;
}

export interface StackCardConfig extends LovelaceCardConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const cardConfigStruct = assign(
theme: optional(string()),
entity: optional(string()),
hide_completed: optional(boolean()),
hide_create: optional(boolean()),
})
);

Expand Down

0 comments on commit e9f3f71

Please sign in to comment.