Anchor Design System

Container3.0

The anchor-container is a component that serves as a generic container for other components or content. It's designed to be flexible and reusable across different parts of an application.

Installation

npm i @tryg/vue-ui-library

Usage

Install the component library as a Vue plugin. This globally registers all Anchor components.

main.js
import { createApp } from 'vue';
import { ComponentLibrary } from '@tryg/vue-ui-library';
import App from './App.vue';

const app = createApp(App);
app.use(ComponentLibrary);
app.mount('#app');
YourComponent.vue
<template>
  <anchor-container>This is an error message.</anchor-container>
</template>

Import only the components you need for optimal bundle size.

YourComponent.vue
<script setup>
import { AnchorContainer } from '@tryg/vue-ui-library';
</script>
<template>
  <anchor-container>This is an error message.</anchor-container>
</template>

Custom Width

Use the --container-width-max CSS custom property to control the maximum width of the container content. By default, the container constrains content to a predefined maximum width. You can override this to suit your layout needs:

anchor-container {
  --container-width-max: 1200px;
}

To allow the container to stretch to full width, set the max width to 100%:

anchor-container {
  --container-width-max: 100%;
}

Custom Margins

Override the horizontal margins per breakpoint using the --container-margin-* CSS custom properties. Each breakpoint has its own variable so you can fine-tune spacing as the viewport changes:

anchor-container {
  --container-margin-xs: 8px;
  --container-margin-sm: 16px;
  --container-margin-md: 24px;
  --container-margin-lg: 32px;
  --container-margin-xl: 48px;
}

CSS variables

The Container component exposes the following CSS custom properties for styling and layout control:

NameDescription
--container-width-maxSet the maximum width of the page content.
--container-margin-xsSet the margin of the container at the smallest screen size.
--container-margin-smSet the margin of the container at the small screen size.
--container-margin-mdSet the margin of the container at the medium screen size.
--container-margin-lgSet the margin of the container at the large screen size.
--container-margin-xlSet the margin of the container at the extra large screen size.

Accessibility

The Container component is a non-semantic wrapper element. It does not add any ARIA roles, states, or semantic meaning to its content. It serves purely as a layout container for constraining and centering content within the viewport.

API

anchor-container

CSS Custom Properties

NameDescription
--container-margin-lgSet the margin of the container at the large screen size.
--container-margin-mdSet the margin of the container at the medium screen size.
--container-margin-smSet the margin of the container at the small screen size.
--container-margin-xlSet the margin of the container at the extra large screen size.
--container-margin-xsSet the margin of the container at the smallest screen size.
--container-width-maxSet the maximum width of the page content.

Built with StencilJS

Anchor versionStatusNotes
3.0Ready for ImplementationThis component is in sync with Figma.

On this page