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

ArticleCard

An editorial card with media, a title, and one link.

Geometric illustration

A field guide to small ideas

Read↗
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 ArticleCardExample from './ArticleCardExample.svelte';
</script>

<ArticleCardExample media={"image"} actionLabel={"Read"} />
<script lang="ts">
  import { ArticleCard } from 'portal-bits';
  let {
    media = 'image',
    actionLabel = 'Read',
  }: { media?: 'image' | 'fallback'; actionLabel?: 'Read' | 'Open' } = $props();

  // 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="#e6ddd0"/><circle cx="370" cy="170" r="120" fill="none" stroke="#776749" stroke-width="2" opacity=".45"/><text x="32" y="178" fill="#776749" font-family="Arial,sans-serif" font-size="66" font-weight="500">field</text></svg>',
  )}`;
</script>

<div class="narrow">
  <ArticleCard
    title="A field guide to small ideas"
    href="#field-guide"
    image={media === 'image' ? poster : undefined}
    imageAlt={media === 'image' ? 'Geometric illustration' : ''}
    {actionLabel}
  />
</div>

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

API reference

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

Props

NameTypeDefaultRequiredBindingDescription
titlestringNoneYesOne-wayThe heading. It is rendered as text, not HTML.
hrefstringNoneYesOne-wayThe destination of the single action link.
imagestringNoneNoOne-wayThe media URL. A failed load keeps the media region with a placeholder.
imageAltstring""NoOne-wayAlt text for the media. Empty marks it decorative.
actionLabelstringReadNoOne-wayThe action text. The link name is the action label followed by the title.
headingLevel2 | 3 | 43NoOne-wayThe heading level of the title.

Forwarded attributes

None. ArticleCard forwards no attributes.

No data attributes are documented as stable.

Limits

  • One native link carries the whole action. The card has no nested buttons or click handler.
  • Intrinsic height, image fitting, and the placeholder art are adaptations.

Related

  • FeatureCard
  • Carousel
Previous AppCard Next FeatureCard

On this page

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