API REFERENCE · LAYOUT
<dj-card>
Content container. Slots: header, default (content), actions. Optional title/subtitle/media-src. clickable makes the body a button. Parts: root, media, body, actions.
npm install @dojo-ng/card
import "@dojo-ng/card";
Navigation
- Set
pathto make the card a link to an app path. The body becomes a real<a href>, so Ctrl/Cmd-click, middle-click, and "open in new tab" work, and a screen reader announces a link. Keep buttons and other controls out of the default slot of such a card, because they would sit inside a link; put them in theactionsslot, which is outside it. - A plain click is turned into
dj-navigate(detail{ path, label },labelbeing the title), which@dojo-ng/historyturns into a navigation. A click with a modifier key, or one that is already prevented, is left to the browser. With no history installed, the link navigates normally, as a full page load. - The
hrefis the path with the historybaseadded, so it stays correct under a prefix. pathwins overclickable: with both set, the body is the link and not a button.- Set
trackto follow the location: the link getsaria-current="page"while the location is this card'spath. The package is only read when history is installed.
Properties
| Property | Attribute | Type | Default |
|---|---|---|---|
kind |
kind reflected |
"elevated""outlined" |
"elevated" |
square |
square |
boolean |
false |
title |
title |
string |
"" |
subtitle |
subtitle |
string |
"" |
mediaSrc |
media-src |
string |
None |
mediaTitle |
media-title |
string |
None |
clickable |
clickable |
boolean |
false |
pathAn app path. Makes the body a link to it. Wins over clickable. |
path |
string |
None |
trackMark the link aria-current="page" while the navigation location is path. Needs @dojo-ng/history installed. |
track |
boolean |
false |
Events
| Event | Description |
|---|---|
dj-navigate | detail { path, label } |
Slots
| Slot | Description |
|---|---|
header | |
| Default slot | content |
actions |
CSS parts
Style these with dj-card::part(name).
rootmediabodyactions