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

Remove card border #48

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@ It allows to group multiple cards into one card without the borders. By default,

If a card inside the stack has the `--keep-background` CSS style defined, it will not replace the background. This is usefull for [button-card](https://github.com/custom-cards/button-card) for example. You can also define this CSS variable by using [card-mod](https://github.com/thomasloven/lovelace-card-mod).

| Name | Type | Requirement | Description | Default |
| ---- | ---- | ----------- | ----------- | ------- |
| `type` | string | **Required** | `custom:stack-in-card` | |
| `title` | string | **Optional** | Header of the card | |
| `mode` | string | **Optional** | `vertical` or `horizontal` stack | `vertical` |
| `cards` | object | **Required** | The cards you want to embed | `none` |
| `keep` | object | **Optional** | See [keep object](#keep-object) | |
| Name | Type | Requirement | Description | Default |
| ------- | ------ | ------------ | -------------------------------- | ---------- |
| `type` | string | **Required** | `custom:stack-in-card` | |
| `title` | string | **Optional** | Header of the card | |
| `mode` | string | **Optional** | `vertical` or `horizontal` stack | `vertical` |
| `cards` | object | **Required** | The cards you want to embed | `none` |
| `keep` | object | **Optional** | See [keep object](#keep-object) | |

### `keep` object

| Name | Type | Requirement | Description | Default |
| ---- | ---- | ----------- | ----------- | ------- |
| `background` | boolean | **Optional** | Will keep the background on **all** the child cards. To keep the background on specific cards only, assign the CSS variable `--keep-background: 'true'` on the card where you want to keep the background. | `false` |
| `box_shadow` | boolean | **Optional** | Will keep the `box-shadow` on **all** the child cards | `false` |
| `margin` | boolean | **Optional** | Will keep the `margin` between **all** the child cards | `false` |
| `outer_padding` | boolean | **Optional** | Will add a `padding` of `8px` to the card if `margin` is `true` | `true` if `margin` is `true`, else false |
| `border_radius` | boolean | **Optional** | Will keep the `border-radius` on **all** the child cards | `false` |
| Name | Type | Requirement | Description | Default |
| --------------- | ------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| `background` | boolean | **Optional** | Will keep the background on **all** the child cards. To keep the background on specific cards only, assign the CSS variable `--keep-background: 'true'` on the card where you want to keep the background. | `false` |
| `box_shadow` | boolean | **Optional** | Will keep the `box-shadow` on **all** the child cards | `false` |
| `margin` | boolean | **Optional** | Will keep the `margin` between **all** the child cards | `false` |
| `outer_padding` | boolean | **Optional** | Will add a `padding` of `8px` to the card if `margin` is `true` | `true` if `margin` is `true`, else false |
| `border_radius` | boolean | **Optional** | Will keep the `border-radius` on **all** the child cards | `false` |
| `border` | boolean | **Optional** | Will keep the `border` on **all** the child cards | `false` |

## Example

Expand Down
2 changes: 2 additions & 0 deletions src/stack-in-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class StackInCard extends LitElement implements LovelaceCard {
margin: false,
box_shadow: false,
border_radius: false,
border: false,
...config.keep,
},
};
Expand Down Expand Up @@ -104,6 +105,7 @@ class StackInCard extends LitElement implements LovelaceCard {
e.style.background = 'transparent';
}
if (!this._config?.keep?.border_radius) e.style.borderRadius = '0';
if (!this._config?.keep?.border) e.style.border = 'none';
}

private _loopChildren(e: LovelaceCard, withBg: boolean): void {
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export interface KeepConfig {
box_shadow?: boolean;
border_radius?: boolean;
outer_padding?: boolean;
border?: boolean;
}