A card that floats on a shell with a matching corner radius. This is a custom component with no Base UI primitive. It provides the LayerCard.Root shell and the LayerCard.Inner card.
Here is the component implementation code that you can copy to your project:
// https://devie-ui.com/components/layer-card
import clsx from "clsx";
import type React from "react";
import styles from "./LayerCard.module.scss";
function Root({ className, ...props }: LayerCard.Root.Props) {
return <div className={clsx(styles.root, className)} {...props} />;
}
function Inner({ className, ...props }: LayerCard.Inner.Props) {
return <div className={clsx(styles.inner, className)} {...props} />;
}
const LayerCard = {
Root,
Inner,
};
namespace LayerCard {
export namespace Root {
export type Props = React.ComponentProps<"div">;
}
export namespace Inner {
export type Props = React.ComponentProps<"div">;
}
}
export default LayerCard;Put one LayerCard.Inner inside LayerCard.Root.
Stack several LayerCard.Inner inside one LayerCard.Root.
Put a title as a direct child of LayerCard.Root, then wrap the content in LayerCard.Inner.
Put the content in LayerCard.Inner, then add a bare paragraph below it for helper text or a secondary link.