Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Tilt Card

    Card that tilts in 3D toward the pointer with a moving glare and optional parallax layers, then eases back. Lifts on keyboard focus.

    Markas Gold member

    0042 1987 5531

    MemberRania Putri

    Since2021

    MarkasGold member

    0042 1987 5531

    MemberRania Putri

    Since2021

    MarkasGold member

    0042 1987 5531

    MemberRania Putri

    Since2021

    Markas Gold member

    0042 1987 5531

    MemberRania Putri

    Since2021

    MarkasGold member

    0042 1987 5531

    MemberRania Putri

    Since2021

    @php
        $stage = 'grid place-items-center py-8';
        $card = 'grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary';
        $row = 'flex items-center justify-between';
        $brand = 'text-base font-semibold';
        $tier = 'rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium';
        $chip = 'h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50';
        $number = 'text-lg font-medium tracking-widest tabular-nums';
        $footer = 'flex items-end justify-between text-sm font-medium';
        $caption = 'block text-xs font-normal text-on-primary/70';
    @endphp
    
    <div class="{{ $stage }}">
        <x-markas.tilt-card :class="$card">
            <div class="{{ $row }}">
                <span class="{{ $brand }}">Markas</span>
                <span class="{{ $tier }}">Gold member</span>
            </div>
            <div data-depth="14" class="{{ $chip }}"></div>
            <p data-depth="8" class="{{ $number }}">0042 1987 5531</p>
            <div class="{{ $footer }}">
                <p><span class="{{ $caption }}">Member</span>Rania Putri</p>
                <p><span class="{{ $caption }}">Since</span>2021</p>
            </div>
        </x-markas.tilt-card>
    </div>
    import { TiltCard } from "@/components/markas/TiltCard";
    
    const stage = "grid place-items-center py-8";
    const card =
      "grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary";
    const row = "flex items-center justify-between";
    const brand = "text-base font-semibold";
    const tier = "rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium";
    const chip = "h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50";
    const number = "text-lg font-medium tracking-widest tabular-nums";
    const footer = "flex items-end justify-between text-sm font-medium";
    const caption = "block text-xs font-normal text-on-primary/70";
    
    export default function TiltCardExample() {
      return (
        <div className={stage}>
          <TiltCard className={card}>
            <div className={row}>
              <span className={brand}>Markas</span>
              <span className={tier}>Gold member</span>
            </div>
            <div data-depth="14" className={chip}></div>
            <p data-depth="8" className={number}>
              0042 1987 5531
            </p>
            <div className={footer}>
              <p>
                <span className={caption}>Member</span>Rania Putri
              </p>
              <p>
                <span className={caption}>Since</span>2021
              </p>
            </div>
          </TiltCard>
        </div>
      );
    }
    <script setup lang="ts">
    import TiltCard from "@/components/markas/TiltCard.vue";
    
    const stage = "grid place-items-center py-8";
    const card =
      "grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary";
    const row = "flex items-center justify-between";
    const brand = "text-base font-semibold";
    const tier = "rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium";
    const chip = "h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50";
    const number = "text-lg font-medium tracking-widest tabular-nums";
    const footer = "flex items-end justify-between text-sm font-medium";
    const caption = "block text-xs font-normal text-on-primary/70";
    </script>
    
    <template>
      <div :class="stage">
        <TiltCard :class="card">
          <div :class="row">
            <span :class="brand">Markas</span>
            <span :class="tier">Gold member</span>
          </div>
          <div data-depth="14" :class="chip"></div>
          <p data-depth="8" :class="number">0042 1987 5531</p>
          <div :class="footer">
            <p><span :class="caption">Member</span>Rania Putri</p>
            <p><span :class="caption">Since</span>2021</p>
          </div>
        </TiltCard>
      </div>
    </template>
    <script lang="ts">
      import TiltCard from "$lib/components/markas/TiltCard.svelte";
    
      const stage = "grid place-items-center py-8";
      const card =
        "grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary";
      const row = "flex items-center justify-between";
      const brand = "text-base font-semibold";
      const tier =
        "rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium";
      const chip = "h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50";
      const number = "text-lg font-medium tracking-widest tabular-nums";
      const footer = "flex items-end justify-between text-sm font-medium";
      const caption = "block text-xs font-normal text-on-primary/70";
    </script>
    
    <div class={stage}>
      <TiltCard class={card}>
        <div class={row}>
          <span class={brand}>Markas</span>
          <span class={tier}>Gold member</span>
        </div>
        <div data-depth="14" class={chip}></div>
        <p data-depth="8" class={number}>0042 1987 5531</p>
        <div class={footer}>
          <p><span class={caption}>Member</span>Rania Putri</p>
          <p><span class={caption}>Since</span>2021</p>
        </div>
      </TiltCard>
    </div>
    ---
    import TiltCard from "@/components/markas/TiltCard.astro";
    
    const stage = "grid place-items-center py-8";
    const card =
      "grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary";
    const row = "flex items-center justify-between";
    const brand = "text-base font-semibold";
    const tier = "rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium";
    const chip = "h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50";
    const number = "text-lg font-medium tracking-widest tabular-nums";
    const footer = "flex items-end justify-between text-sm font-medium";
    const caption = "block text-xs font-normal text-on-primary/70";
    ---
    
      <div class={stage}>
        <TiltCard class={card}>
          <div class={row}>
            <span class={brand}>Markas</span>
            <span class={tier}>Gold member</span>
          </div>
          <div data-depth="14" class={chip}></div>
          <p data-depth="8" class={number}>0042 1987 5531</p>
          <div class={footer}>
            <p><span class={caption}>Member</span>Rania Putri</p>
            <p><span class={caption}>Since</span>2021</p>
          </div>
        </TiltCard>
      </div>
    import { Component } from "@angular/core";
    import { TiltCard } from "./markas/tilt-card.component";
    
    @Component({
      selector: "markas-example",
      imports: [TiltCard],
      template: `
        <div [class]="stage">
          <markas-tilt-card [class]="card">
            <div [class]="row">
              <span [class]="brand">Markas</span>
              <span [class]="tier">Gold member</span>
            </div>
            <div data-depth="14" [class]="chip"></div>
            <p data-depth="8" [class]="number">0042 1987 5531</p>
            <div [class]="footer">
              <p><span [class]="caption">Member</span>Rania Putri</p>
              <p><span [class]="caption">Since</span>2021</p>
            </div>
          </markas-tilt-card>
        </div>
      `,
    })
    export default class TiltCardExample {
      protected readonly stage = "grid place-items-center py-8";
      protected readonly card =
        "grid aspect-[1.586/1] w-80 content-between bg-linear-to-br from-primary to-primary-strong p-6 text-on-primary";
      protected readonly row = "flex items-center justify-between";
      protected readonly brand = "text-base font-semibold";
      protected readonly tier =
        "rounded-full bg-on-primary/15 px-2.5 py-0.5 text-xs font-medium";
      protected readonly chip =
        "h-8 w-11 rounded-md bg-linear-to-br from-warning to-warning/50";
      protected readonly number =
        "text-lg font-medium tracking-widest tabular-nums";
      protected readonly footer =
        "flex items-end justify-between text-sm font-medium";
      protected readonly caption = "block text-xs font-normal text-on-primary/70";
    }

    Examples

    Product card with parallax image

    Studio headphones

    Wireless, 40 hour battery

    $129

    Studio headphones

    Wireless, 40 hour battery

    $129

    Studio headphones

    Wireless, 40 hour battery

    $129

    Studio headphones

    Wireless, 40 hour battery

    $129

    Studio headphones

    Wireless, 40 hour battery

    $129

    Profile card

    Adi Santoso

    Product designer, Bandung

    48Projects

    1.2kFollowers

    312Following

    Adi Santoso

    Product designer, Bandung

    48Projects

    1.2kFollowers

    312Following

    Adi Santoso

    Product designer, Bandung

    48Projects

    1.2kFollowers

    312Following

    Adi Santoso

    Product designer, Bandung

    48Projects

    1.2kFollowers

    312Following

    Adi Santoso

    Product designer, Bandung

    48Projects

    1.2kFollowers

    312Following

    Subtle tilt without glare

    Pro

    Popular

    $12 per month

    • Unlimited projects
    • Custom domains
    • Priority support
    Choose Pro

    Pro

    Popular

    $12 per month

    • Unlimited projects
    • Custom domains
    • Priority support
    Choose Pro

    Pro

    Popular

    $12 per month

    • Unlimited projects
    • Custom domains
    • Priority support
    Choose Pro

    Pro

    Popular

    $12 per month

    • Unlimited projects
    • Custom domains
    • Priority support
    Choose Pro

    Pro

    Popular

    $12 per month

    • Unlimited projects
    • Custom domains
    • Priority support
    Choose Pro

    Installation

    npx markasui@latest add tilt-card

    Usage

    <x-markas.tilt-card :max-angle="12" class="w-72 border border-line bg-surface p-5">
        <img data-depth="16" src="/img/headphones.png" alt="" class="rounded-lg" />
        <p class="mt-4 font-semibold">Studio headphones</p>
        <x-markas.button>Add to cart</x-markas.button>
    </x-markas.tilt-card>

    Needs Alpine.js.

    import { TiltCard } from "@/components/markas/TiltCard";
    
    <TiltCard maxAngle={12} className="w-72 border border-line bg-surface p-5">
      <img
        data-depth="16"
        src="/img/headphones.png"
        alt=""
        className="rounded-lg"
      />
      <p className="mt-4 font-semibold">Studio headphones</p>
    </TiltCard>;
    <template>
      <TiltCard :max-angle="12" class="w-72 border border-line bg-surface p-5">
        <img data-depth="16" src="/img/headphones.png" alt="" class="rounded-lg" />
        <p class="mt-4 font-semibold">Studio headphones</p>
      </TiltCard>
    </template>
    <script lang="ts">
      import TiltCard from "$lib/components/markas/TiltCard.svelte";
    </script>
    
    <TiltCard maxAngle={8} class="border border-line bg-surface p-6">
      <div data-depth="20">Pro plan</div>
    </TiltCard>
    ---
    import TiltCard from "@/components/markas/TiltCard.astro";
    ---
    
    <TiltCard maxAngle={8} class="border border-line bg-surface p-6">
      <div data-depth="20">Pro plan</div>
    </TiltCard>

    One small bundled script serves every card on the page.

    import { Component } from "@angular/core";
    import { TiltCard } from "./markas/tilt-card.component";
    
    @Component({
      selector: "app-plan",
      imports: [TiltCard],
      template: `
        <markas-tilt-card [maxAngle]="8" class="border border-line bg-surface p-6">
          <div data-depth="20">Pro plan</div>
        </markas-tilt-card>
      `,
    })
    export class Plan {}
    • The card rotates up to maxAngle degrees toward the pointer through the --tilt-x and --tilt-y custom properties, and eases back when the pointer leaves.
    • Children with data-depth="16" shift up to 16px for parallax. Use it on one or two elements.
    • Keyboard focus on a link or button inside lifts the card slightly. With reduced motion the card stays flat.
    • glare={false} removes the moving light. Attributes and class go to the card itself.

    Props

    NameTypeDefaultDescription
    maxAnglenumber10Largest rotation in degrees, reached when the pointer is at a card edge. 4 to 8 feels subtle, 12 to 15 playful.
    glarebooleantrueShows a soft light that follows the pointer across the card.
    children / slotReactNode / slot-Card content. Style the card with your own classes (background, border, padding). Children with data-depth="16" shift up to that many px for parallax.

    Accessibility

    • The tilt, glare, and parallax are visual only; the glare is an aria-hidden layer that never catches the pointer.
    • When a link or button inside the card has keyboard focus, the card lifts slightly so the focus is easy to follow.
    • With reduced motion the card stays flat and still, with no glare.

    Related components

    More markasui components with the same classes in every framework.