menu
Dark Mode
backgroundLayer 1
preact-material-components
Components and their props
  • Card
    • no specific props
  • Card.Primary
    • no specific props
  • Card.SupportingText
    • no specific props
  • Card.Actions
    • vertical true/false
      This arranges the actions vertically
  • Card.Action
    • no specific props
  • Card.Media
    • no specific props
  • Card.MediaItem
    • x 1dot5, 2, 3
      Changes the size of the image
  • Card.Title
    • large true/false
      This enlarges the title size
  • Card.Subtitle
    • no specific props
  • Card.HorizontalBlock
    • no specific props
Sample code
import {h, Component} from 'preact';
import Card from 'preact-material-components/Card';
import 'preact-material-components/Card/style.css';
import 'preact-material-components/Button/style.css';

export default class CardsPage extends Component {
  render(){
    return (
      <div>
        <Card>
          <Card.Primary>
            <Card.Title>Hi</Card.Title>
            <Card.Subtitle>Let me subtitle</Card.Subtitle>
          </Card.Primary>
          <Card.Media className='card-media'></Card.Media>
          <Card.Actions>
            <Card.Action>OKAY</Card.Action>
          </Card.Actions>
        </Card>
        <Card>
          <Card.HorizontalBlock>
            <Card.Primary>
              <Card.Title large>Hi</Card.Title>
              <Card.Subtitle>Let me subtitle</Card.Subtitle>
            </Card.Primary>
            <Card.MediaItem src="some-picture.jpg" x="1dot5" />
          </Card.HorizontalBlock>
          <Card.Actions>
            <Card.Action>OKAY</Card.Action>
          </Card.Actions>
        </Card>
      </div>
    );
  }
}
Original documentation
This component encapsulates mdc-card, you can refer to its documentation here.
Demo

Hi

Let me subtitle

Hi

Let me subtitle

Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

Hi

Let me subtitle