Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    Aspect Ratio

    A box that keeps its width-to-height ratio at any width. It is shadcn's AspectRatio, unchanged, and draws nothing itself: round the media with Nelumbo's radius.

    Install

    npx shadcn@latest add @nelumbo/aspect-ratio

    Ratios

    Pass ratio as width over height. Photos and video use 16 / 9, square thumbnails 1, portraits 3 / 4.

    16 / 9
    1 / 1
    3 / 4

    Nelumbo radius

    rounded-xl suits photos and cards, rounded-2xl large hero images, rounded-full an avatar-like crop. Add overflow-hidden when the box holds an image.

    rounded-lg
    rounded-2xl
    rounded-full

    Usage

    <AspectRatio ratio={16 / 9} className="overflow-hidden rounded-xl bg-surface-container-high">  <img src="/cover.jpg" alt="" className="size-full object-cover" /></AspectRatio>

    Props

    PropTypeDefaultNotes
    rationumber1Width divided by height.
    asChildbooleanfalseRender the child element as the box.