Card components with Mytril

The Card component in Mytril offers a modular and flexible interface to structure and display headings, text, images, icons, and actions. It’s designed to streamline your layout while keeping your code maintainable and responsive.

Core subcomponents

Mytril’s card system is built on reusable subcomponents, enabling granular control over layout and design.

ComponentDescription
CardThe container that houses all card subcomponents
CardItemDefines sections within the card with customizable margins and padding
CardTitleDisplays the card’s title
CardSubtitleAdds a subtitle below the title for additional context
CardTextEmbeds descriptive text or other content inside the card
CardActionsCreates an area for buttons or other actionable elements like links

Example usage

<script>
	import {
		Card,
		CardItem,
		CardTitle,
		CardSubtitle,
		CardText,
		CardActions,
		Btn,
		Spacer
	} from 'mytril';
</script>

<Card>
	<CardItem>
		<CardTitle>Title</CardTitle>
		<CardSubtitle>Subtitle</CardSubtitle>
		<CardText>Lorem Ipsum</CardText>
		<CardActions>
			<Spacer />
			<Btn>Button</Btn>
		</CardActions>
	</CardItem>
</Card>

Properties overview

Card

<script>
	import { Card } from 'mytril';
</script>

<Card>// your content</Card>
PropertyTypeDefaultDescription
tagstringdivCustom tag for the root element
darkbooleanfalseForce a dark theme
lightbooleanfalseForce a light theme
activebooleanfalseAdds hover/active effects
hrefstringundefinedConverts the card into an anchor element
outlinedbooleanfalseAdds a border and removes the background
textbooleanfalseRemoves both background and border styles
disabledbooleanfalseDisables interaction styles for button or anchor cards
roundedstringundefinedAdds border radius to the Card
colorstringundefinedSets the card’s background color. Accepts HEX, RGB, RGBA, X11, or Mytril themes colors
colorTextstringundefinedSets the text color. Ignored when outline or text is active

CardItem

<script>
	import { Card, CardItem } from 'mytril';
</script>

<Card>
	<CardItem>// your content</CardItem>
</Card>

CardItem has 3 slots for display your content

SlotDescription
defaultMain content slot
prependContent to display at the start
appendContent to display at the end

CardTitle

<script>
	import { Card, CardItem, CardTitle } from 'mytril';
</script>

<Card>
	<CardItem>
		<CardTitle>Title</CardTitle>
	</CardItem>
</Card>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.

CardSubtitle

<script>
	import { Card, CardItem, CardTitle, CardSubtitle } from 'mytril';
</script>

<Card>
	<CardItem>
		<CardTitle>Title</CardTitle>
		<CardSubtitle>SubTitle</CardSubtitle>
	</CardItem>
</Card>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.
opacitynumber or stringundefinedAdd opacity on content.

CardText

<script>
	import { Card, CardItem, CardTitle, CardSubtitle, CardText } from 'mytril';
</script>

<Card>
	<CardItem>
		<CardTitle>Title</CardTitle>
		<CardSubtitle>SubTitle</CardSubtitle>
		<CardText>// your content</CardText>
	</CardItem>
</Card>
PropertyTypeDefaultDescription
tagstringdivSpecify a custom tag used on the root element.
opacitynumber or stringundefinedAdd opacity on content.

CardActions

<script>
	import { Card, CardItem, CardTitle, CardSubtitle, CardText, CardActions } from 'mytril';
</script>

<Card>
	<CardItem>
		<CardTitle>Title</CardTitle>
		<CardSubtitle>SubTitle</CardSubtitle>
		<CardText>// your content</CardText>
		<CardActions>// actions area</CardActions>
	</CardItem>
</Card>

Why use Mytril’s card component?

  • Simplified development: predefined components minimize custom CSS requirements, enabling rapid prototyping
  • Responsive design: automatic adaptation to various screen sizes maintains UI consistency
  • Customizable: rich properties and slots enable precise adjustments for specific needs
  • Accessibility: semantic HTML foundation ensures strong accessibility and SEO performance

Mytril’s card component delivers a clean, scalable foundation for modern web applications, elevating both development efficiency and user experience.

  1. Home
Help us improve this component!
or

Minedelve respects your privacy

Minedelve and our partners use cookies or similar technologies to enable us to improve the site, your experience and to ensure the proper functioning of the site, to collect statistics in order to optimize the services offered, and to adapt Minedelve's content.