@not-govuk/width-container

A simple container to limit the width of its contents.

Usage no npm install needed!

<script type="module">
  import notGovukWidthContainer from 'https://cdn.skypack.dev/@not-govuk/width-container';
</script>

README

Width Container

A simple container to limit the width of its contents.

This is used by the page components to control the width of the page contents. Users will not typically need to use this.

Using this package

First install the package into your project:

npm install -S @not-govuk/width-container

Then use it in your code as follows:

import React, { createElement as h } from 'react';
import WidthContainer from '@not-govuk/width-container';

const myMaxWidthInPixels = 300;

export const MyComponent = props => (
  <WidthContainer maxWidth={myMaxWidthInPixels}>
    My contents
  </WidthContainer>
);

export default MyComponent;

Working on this package

Before working on this package you must install its dependencies using the following command:

pnpm install

Testing

npm test

Building

npm run build

Clean-up

npm run clean