Bento Grid
Disposition de grille de style bento reactive avec des cartes de fonctionnalites. Installez Bento Grid depuis le registre VLLNT UI avec la CLI shadcn.
Disposition de grille de style bento reactive avec des cartes de fonctionnalites. Fait partie de la famille content dans VLLNT UI, il est publie comme entree de registre lisible par machine — copiez la source directement dans votre application avec la CLI shadcn et possedez-la, sans dependance d'execution a une bibliotheque de composants.
Apercu
Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.
Installation
Ajoutez Bento Grid a votre projet avec la CLI shadcn. La source arrive dans votre code, prete a etre adaptee :
pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/bento-grid.jsonSource
import * as React from "react";
import { cn } from "../../lib/utils";
/** Props for {@link BentoGrid}. */
export type BentoGridProps = React.ComponentPropsWithoutRef<"div">;
/** Props for {@link BentoCard}. */
export type BentoCardProps = React.ComponentPropsWithoutRef<"div">;
/**
* Responsive masonry-style grid that lays out {@link BentoCard} tiles.
*
* @example
* ```tsx
* <BentoGrid>
* <BentoCard className="col-span-2">Featured</BentoCard>
* <BentoCard>Detail</BentoCard>
* </BentoGrid>
* ```
*/
export const BentoGrid = ({
children,
className,
ref,
...props
}: BentoGridProps & { ref?: React.Ref<HTMLDivElement> }) => {
return (
<div
className={cn(
"grid w-full auto-rows-[14rem] grid-cols-3 gap-4",
className,
)}
ref={ref}
{...props}
>
{children}
</div>
);
};
BentoGrid.displayName = "BentoGrid";
/**
* Single tile inside a {@link BentoGrid} with a hover shadow lift.
*
* @example
* ```tsx
* <BentoCard className="col-span-2 row-span-2">Highlight</BentoCard>
* ```
*/
export const BentoCard = ({
children,
className,
ref,
...props
}: BentoCardProps & { ref?: React.Ref<HTMLDivElement> }) => {
return (
<div
className={cn(
"group relative flex flex-col justify-between overflow-hidden rounded-xl border bg-card p-6 text-card-foreground shadow-sm transition-shadow hover:shadow-md",
className,
)}
ref={ref}
{...props}
>
{children}
</div>
);
};
BentoCard.displayName = "BentoCard";
Stories
Explorez chaque variante et etat dans le Storybook interactif :
Apercu
Basculez entre clair et sombre pour inspecter l'apercu Storybook integre.