No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

This is a pre-release version and is not production ready. For new and ongoing projects, please refer to the latest Design System version.

Position

Define the positioning method of an element, as well as its position relative to top, bottom, start and end easily with utility classes.


Note that these utility classes are not responsive.
<div class="my-element position-absolute top-0 start-50 translate-middle"></div>
NameDescriptionDefaultControl
General
Position
Sets the position.
string
-
Start
Sets the distance from start (left in LTR).
string
-
Top
Sets the distance from top.
string
-
Translate middle
Set to true to center align an element based on its x and y position.
string
-

Here are the different positioning methods available for elements.

  • position-static (default) positions the element according to the flow of the page.
  • position-relative positions the element according to the flow of the page, but you can offset it relatively to itself by settings values for top, bottom, start and end.
  • position-absolute removes the element from the flow of the page and positions it relatively to its closest positioned element.
  • position-fixed removes the element from the flow of the page and positions it relatively to the viewport.
  • position-sticky positions the element according to the flow of the page but "sticks" it in place in the case of a scrolling container.

Some utility classes are here to define the position from the edges of the container more easily.

  • top-{0|50|100} to set the position of the element from the top of the container by 0, 50% or 100%.
  • bottom-{0|50|100} to set the position of the element from the bottom of the container by 0, 50% or 100%.
  • start-{0|50|100} to set the position of the element from the start of the container (left in LTR) by 0, 50% or 100%.
  • end-{0|50|100} to set the position of the element from the end of the container (right in LTR) by 0, 50% or 100%.

The class .translate-middle is there to center an element horizontally and vertically on their x and y position. You can also use .translate-middle-x to only center the element horizontally and .translate-middle-y to center it vertically.

On the example above, the black dot is the center of the container. Both squares are positioned 50% from the top and 50% from the start. The blue square has the translate-middle class and the yellow one doesn't.