Stack
tetra-ui/stackFreeComponent
A layout component that stacks children horizontally or vertically with consistent spacing.
Live preview
live · rendered by the registry
Rendered by tetra-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://tetra-ui.com/r/stack.jsonSource
1import { cva, type VariantProps } from "class-variance-authority";2import { View } from "react-native";3import { cn } from "../lib/utils";45// Types6export type StackProps = React.ComponentProps<typeof View> &7 VariantProps<typeof stackVariants>;89// Components10export const Stack = ({11 children,12 className,13 gap,14 direction,15 ...props16}: StackProps) => {17 return (18 <View19 className={cn(stackVariants({ className, direction, gap }))}20 {...props}21 >22 {children}23 </View>24 );25};2627// Styles28const stackVariants = cva("flex", {29 variants: {30 direction: {31 column: "flex-col",32 "column-reverse": "flex-col-reverse",33 row: "flex-row",34 "row-reverse": "flex-row-reverse",35 },36 gap: {37 "2xl": "gap-6",38 lg: "gap-4",39 md: "gap-3",40 none: "gap-0",41 sm: "gap-2",42 xl: "gap-5",43 xs: "gap-1",44 },45 },46});
Files it writes
More from tetra-ui
All 41 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | tetra-ui | Components | Free | 1 dep | |
| Action Inputaction-input | tetra-ui | Components | Free | no deps | |
| Alertalert | tetra-ui | Components | Free | no deps | |
| Avataravatar | tetra-ui | Components | Free | no deps | |
| Badgebadge | tetra-ui | Components | Free | no deps | |
| Bottom Sheetbottom-sheet | tetra-ui | Components | Free | 4 deps · 7 files | |
| Buttonbutton | tetra-ui | Components | Free | no deps | |
| Cardcard | tetra-ui | Components | Free | no deps |
