diff --git a/packages/materialdesign-components/components.json b/packages/materialdesign-components/components.json index d017e54b11..9289f77652 100644 --- a/packages/materialdesign-components/components.json +++ b/packages/materialdesign-components/components.json @@ -111,6 +111,52 @@ }, "tags": [] }, + "Card": { + "name": "Card", + "description": "A Material Card container. Accepts CardHeader, CardBody and CardFooter as possible children", + "props": { + "width": "string", + "height": "string", + "variant": { + "type": "options", + "options": ["standard", "outlined"], + "default": "standard" + } + } + }, + "CardBody": { + "name": "CardBody", + "description": "A Material CardBody component. Contains the main content of a Material Card component", + "props": { + "onClick": "event" + } + }, + "CardImage": { + "name": "CardImage", + "description": "An image component for the Material Card component", + "props": { + "displayHorizontal": "bool", + "url": "string", + "title": "string", + "subtitle": "string" + } + }, + "CardHeader": { + "name": "CardHeader", + "description": "Displays a icon, title and subtitle above main body of the Material Card component", + "props": { + "title": "string", + "subtitle": "string", + "icon": "string" + } + }, + "CardFooter": { + "name": "CardFooter", + "description": "Displays buttons / icon buttons as actions for the Material Card component", + "props": { + "padding": "string" + } + }, "Checkbox": { "name": "Checkbox", "description": "A Material Design checkbox. Supports aligning label before or after checkbox.", diff --git a/packages/materialdesign-components/src/Card/Card.svelte b/packages/materialdesign-components/src/Card/Card.svelte index d32f34f04f..6a67ceb92c 100644 --- a/packages/materialdesign-components/src/Card/Card.svelte +++ b/packages/materialdesign-components/src/Card/Card.svelte @@ -21,18 +21,22 @@ $: props = { modifiers } $: cardClass = cb.build({ props }) + $: safeWidth = width !== "auto" && !/px$/.test(width) ? `${width}px` : width + $: safeHeight = + height !== "auto" && !/px$/.test(height) ? `${width}px` : height + $: card && _bb.attachChildren(card)