Skip to content

Instantly share code, notes, and snippets.

@sethdavis512
Created April 14, 2024 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sethdavis512/2ae1c2f576a9bcef4074ec38fa19a24c to your computer and use it in GitHub Desktop.
Save sethdavis512/2ae1c2f576a9bcef4074ec38fa19a24c to your computer and use it in GitHub Desktop.
Grid component (Tailwind)
import { type ReactNode } from 'react';
interface GridProps {
children: ReactNode;
as?: keyof JSX.IntrinsicElements;
className?: string;
}
export default function Grid({ as = 'div', children, className }: GridProps) {
const Component = as;
return (
<Component className={`grid grid-cols-12 ${className}`}>
{children}
</Component>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment