Skip to content
portalbits
Home Docs GitHub(opens in a new tab)

Guides

Get startedFoundationsMotion

Components

All components

Buttons

ButtonIconButton

Inputs

InputSelectTextareaSlider

Selection

CheckboxToggleToggleGroupSwitchRadioGroup

Identity

AvatarBadge

Overlays

DialogPopoverTooltipDropdownMenuAlertDialog

Disclosure

TabsAccordion

Cards

AppCardArticleCardFeatureCard

Content

CarouselSectionHeaderEmptyStateAlertProgressSeparatorRowListRow

Chrome

PortalShellSidebarNavMobileNavTopBarAuthFrameColorSelectorFloatingNav

AppCard

A collection card with media, a favorite, and an optional action.

Orbit geometric poster
Creative
OS

Orbit Studio

Creative

Your next idea starts here.

Variations

Source

<script lang="ts">
  import 'portal-bits/styles.css';
  import 'portal-bits/tokens.css';
  import type { Snippet } from 'svelte';

  let { children }: { children: Snippet } = $props();
</script>

{@render children()}
<script lang="ts">
  import AppCardExample from './AppCardExample.svelte';
</script>

<AppCardExample media={"image"} spotlight={false} action={false} />
<script lang="ts">
  import { AppCard } from 'portal-bits';
  let {
    media = 'image',
    spotlight = false,
    action = false,
  }: { media?: 'image' | 'fallback'; spotlight?: boolean; action?: boolean } = $props();
  let favorite = $state(false);

  // A synthetic poster as inline SVG data. Pass your own image URL as `image` instead.
  const poster = `data:image/svg+xml,${encodeURIComponent(
    '<svg xmlns="http://www.w3.org/2000/svg" width="640" height="400" viewBox="0 0 640 400"><rect width="640" height="400" fill="#c5d4f6"/><circle cx="370" cy="170" r="120" fill="none" stroke="#263864" stroke-width="2" opacity=".45"/><text x="32" y="178" fill="#263864" font-family="Arial,sans-serif" font-size="66" font-weight="500">ORBIT</text></svg>',
  )}`;
</script>

<div class="narrow">
  <AppCard
    title="Orbit Studio"
    category="Creative"
    description="Your next idea starts here."
    image={media === 'image' ? poster : undefined}
    imageAlt={media === 'image' ? 'Orbit geometric poster' : ''}
    {spotlight}
    href={action ? '#open-orbit' : undefined}
    bind:favorite
  />
</div>

<style>
  .narrow {
    max-width: 360px;
  }
</style>

API reference

These tables list the props and snippets that AppCard declares. Attributes passed through to an element or primitive are listed under Forwarded attributes, not here.

Props

NameTypeDefaultRequiredBindingDescription
titlestringNoneYesOne-wayThe app name. It is the heading and names the favorite control.
categorystringNoneYesOne-wayThe category shown under the title, and in the badge unless `spotlight` is on.
descriptionstringNoneNoOne-waySupporting text. It is hidden when `spotlight` is on.
imagestringNoneNoOne-wayThe cover image URL. A failed load shows the title initial.
imageAltstring""NoOne-wayAlt text for the cover image.
favoritebooleanfalseNoBindableThe favorite state of the heart control.
spotlightbooleanfalseNoOne-wayShows a Featured badge and hides the description.
hrefstringNoneNoOne-wayRenders an Explore link button. Ignored when `action` is given.

Snippets

NameTypeDefaultRequiredBindingDescription
actionSnippetNoneNoOne-wayReplaces the Explore link button.
childrenSnippetNoneNoOne-wayExtra content below the description.

Forwarded attributes

None. AppCard forwards no attributes.

No data attributes are documented as stable.

Limits

  • The heading is always an `h3`.
  • The favorite control is separate from the card. The card has no click handler.
  • The "Featured" and "Explore" strings are English text inside the component.

Related

  • ArticleCard
  • FeatureCard
Previous Accordion Next ArticleCard

On this page

  • Preview
  • Source
  • API reference
  • Props
  • Snippets
  • Forwarded attributes
  • Limits