Skip to content
SiteEmail

Block

The Block component is a structural element designed to act as an element container. The Block component is meant to be used as a wrapper of your other components for logical or styling purposes.

The default use case for the Block component is as an element container.

import Bottom from '@components/Layout/Bottom/Bottom';
import Block from '@components/Layout/Block/Block';
const App = () => {
return (
<Block>
<Bottom>Bottom Content</Bottom>
</Block>
);
};
export default App;
Prop NameTypeDefaultDescription
styleJSX.CSSProperties{}Inline styles to apply directly to the component’s root element.
classstring""Additional CSS classes to apply to the component
refHTMLDivElementundefinedRetrieves the component’s DOM element and assigns it to a variable.
onActionRecord<string, (scope?: string, ...args: any[]) => void>undefinedAllows you to add custom navigation action handlers to the component. See the Navigation component documentation for details.
anchorstring | HTMLElementundefinedLinks navigation to another element. When the anchor element is focused, this component’s actions will execute. Can be a CSS selector or HTMLElement.

To access the HTML DOM element of the Block component.

  1. Declare a variable to hold the ref but don’t initialize it with a value
  2. The declared value should have a type of HTMLDivElement
  3. Set the declared variable as the value of the ref prop of the Block component
import Bottom from '@components/Layout/Bottom/Bottom';
import Block from '@components/Layout/Block/Block';
const App = () => {
let blockRef!: HTMLDivElement
return (
<Block ref={blockRef}>
<Bottom>Bottom Section</Bottom>
</Block>
);
};

Now you can access the HTML element of Block with blockRef and make modifications to it if needed.