Skip to content

Commit 8effa48

Browse files
authored
default slot + story (#568)
1 parent b4be148 commit 8effa48

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/uui-card/lib/uui-card.element.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
SelectOnlyMixin,
44
} from '@umbraco-ui/uui-base/lib/mixins';
55
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
6-
import { css, LitElement } from 'lit';
6+
import { css, html, LitElement } from 'lit';
77
import { property } from 'lit/decorators.js';
88

99
import { UUICardEvent } from './UUICardEvent';
@@ -12,6 +12,7 @@ import { UUICardEvent } from './UUICardEvent';
1212
* @element uui-card
1313
* @fires {UUICardEvent} open - fires when the card title is clicked.
1414
* @description - Base card component to be extended by specific card elements.
15+
* @slot - Default content.
1516
*/
1617
@defineElement('uui-card')
1718
export class UUICardElement extends SelectOnlyMixin(
@@ -158,6 +159,10 @@ export class UUICardElement extends SelectOnlyMixin(
158159
e.stopPropagation();
159160
this.dispatchEvent(new UUICardEvent(UUICardEvent.OPEN));
160161
}
162+
163+
protected render() {
164+
return html`<slot></slot>`;
165+
}
161166
}
162167

163168
declare global {

packages/uui-card/lib/uui-card.story.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const Template: Story = () => html`
1818
Card is a Component that provides the basics for a Card component. This can
1919
be extended in code to match a certain need.
2020
</p>
21+
22+
<uui-card selectable>
23+
<h5 class="uui-h5">Context of the card<h5>
24+
</uui-card>
2125
`;
2226

2327
export const AAAOverview = Template.bind({});

0 commit comments

Comments
 (0)