Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link support for names #232

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Install through [HACS](https://hacs.xyz/)
| color_limit | string | **Optional** | 1 | State value for coloring the box based on state value
| color_above | string | **Optional** | var(--paper-item-icon-color)| Color for state value above color_limit
| color_below | string | **Optional** | var(--primary-color)| Color for state value below color_limit
| url | string | **Optional** | | URL for name link
amaximus marked this conversation as resolved.
Show resolved Hide resolved
| add_entities | list | **Optional** | | Experimental. List of entity ids. Their states will be added to this entity, showing a sum.
| subtract_entities | list | **Optional** | | Experimental. List of entity ids. Their states will be subtracted from this entity's state
| tap_action | action | **Optional** | more-info | Home assistant action to perform on tap. Supported action types are `more-info`, `zoom`, `navigate`, `url`, `toggle`, `call-service`, `fire-dom-event`
Expand Down
2 changes: 1 addition & 1 deletion src/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function renderLabel(
</span>`
: null}
${show_names
? html`${!vertical ? html`&nbsp;` : null}<span class="name" style=${styleMap(nameStyle)}>${name}</span>`
? html`${!vertical ? html`&nbsp;` : null}<span class="name" style=${styleMap(nameStyle)}>${(typeof box.config.url === 'undefined' || box.config.url === null) ? html`${name}` : html`<a href="${box.config.url}" target="_blank">${name}</a>`}</span>`
amaximus marked this conversation as resolved.
Show resolved Hide resolved
: null}
</div>`;
}
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface EntityConfig {
color_above?: string;
color_below?: string;
color_limit?: number;
url?: string;
tap_action?: ActionConfigExtended;
double_tap_action?: ActionConfigExtended;
hold_action?: ActionConfigExtended;
Expand Down