Skip to main content

Box

danger

This SDK is a Work In Progress! All features are subject to change.

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..)

Usage

Box

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 children should wrap to the next line when space runs out.
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"
"column"
NoLayout direction for children (row for horizontal, column for vertical).
idstringNoOptional unique identifier for the component.