Pular para o conteúdo principal

Box

Box container, supports multiple sizes, styling and alignment options. It's used mostly to embed other components that don't have their own layout options (fields, texts, images, etc..)

Box

Usage

Example
import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Box } from "@tiendanube/nube-sdk-jsx";

function MyComponent() {
return (
<Box width={100} height={200}>
{/* children */}
</Box>
);
}

export function App(nube: NubeSDK) {
nube.send("ui:slot:set", () => ({
ui: {
slots: {
after_line_items: <MyComponent />,
},
},
}));
}

Properties

PropertyTypeRequiredDescription
childrenNubeChildrenComponentNoArray of child components nested inside the box.
widthSizeNoWidth of the box (e.g., "100%", "200px").
heightSizeNoHeight of the box.
marginSizeNoOuter spacing around the box.
paddingSizeNoInner spacing of the box (e.g., "16px").
styleStyleSheetNoCustom styles for the box.
gapSizeNoSpacing between child elements (e.g., "1rem").
borderRadiusSizeNoBorder radius of the box (e.g., "8px").
reversebooleanNoWhether to reverse the order of children in the layout direction (applies row-reverse or column-reverse).
backgroundstringNoBackground color (can be CSS variable like "var(--primary-color)").
colorstringNoContent color (can be CSS variable like "var(--primary-color)").
alignItemsFlexItemsNoThe CSS property align-items
alignContentFlexContentNoThe CSS property align-content
justifyContentFlexContentNoThe CSS property justify-content
direction"row"
"col"
NoLayout direction for children (row for horizontal, col for vertical).
idstringNoOptional unique identifier for the component.