# ![Bruck](logo.png) **Bruck** is a lo-fi prototyping system made with web components. Quickly create and comment on interface layouts. The output is screen reader accessible, and responsive without you having to author breakpoints. [**Try out the demo**](https://heydon.github.io/bruck/) **Warning: Bruck is experimental, and in its very early stages of development.**
Split screen showing the web component code compared to the outputted design
You can mock up real or dummy content with a set of primitive layout components
## Get started 1. Clone this repository. 2. (No `npm install` because there's no dependencies, unless you want to contribute — then you may need the **Jest** stuff) 3. Write HTML with the help of the components (below) in the `index.html` and split-screen `editor.html` files. Check out a demo in `demo.html`. 4. Serve by using something like [http-server](https://www.npmjs.com/package/http-server) at the root 5. That's pretty much it. Requests and contribution offers welcome. ## Documentation (Used in conjunction with the [utility classes](#utility-classes).) * [Components](#components) * [``](#t-ext) * [``](#w-ords) * [``](#i-mage) * [``](#c-enter) * [``](#b-ox) * [``](#s-tack) * [``](#g-rid) * [``](#c-luster) * [``](#s-pread) * [``](#s-idebar) * [``](#l-ine) * [``](#i-con) * [``](#p-rogress) * [``](#d-rawer) * [``](#s-creen) * [``](#g-o) * [``](#f-low) * [``](#c-omment) * [``](#c-lone) * [``](#i-nput) * [``](#t-extarea) * [``](#s-elect) * [``](#c-heckbox) * [``](#r-adios) * `` ([see **Working with data**](#working-with-data)) * `` ([see **Working with data**](#working-with-data)) * [Utility classes](#utility-classes) * [Working with data](#working-with-data) * [Actions](#actions) ## Components ### `` The `` component lets you generate a paragraph of dummy text. Each word is represented as a line. 'Words' wrap like any other text content. #### Props
words

A comma separated range e.g. words="30,60"

Default: 15,20

#### Example ```html ``` #### Accessibility information Just the lorem ipsum text underlying the emblematic line-words. ### `` The `` component lets you generate sets of words, picked at random from lorem ipsum. It is an inline element, so can be used to generate text inside a `

` or `

` etc. #### Props
count

The number of words. Can be a set integer e.g. count="5" or a random integer picked from a supplied range e.g. count="5,10".

Default: 2,3

capitalize

Capitalizes the first letter of each word (Boolean)

sentence

Capitalizes the first letter of the first word, and appends a period followed by a space (Boolean)

repeat

How many times to repeat the pattern (i.e. how many sentences to produce). Can be a set integer e.g. count="5" or a random integer picked from a supplied range e.g. count="5,10".

#### Example The following will produce a paragraph or 3-4 sentences. ```html

``` #### Accessibility information Just the lorem ipsum text verbatim. ### `` The `` element creates an accessible dummy/placeholder image (with a X-through style generated via Houdini's Paint API). The available horizontal space is filled unless `minWidth` and `maxWidth` props are supplied. #### Props
ratio

The expression of an aspect ratio e.g. ratio="3:4".

Default: 1:1

caption

The text for a caption, which is placed in a <figcaption> element after the image itself e.g. caption="A giant crab monster".

Default: nothing (<figcaption> omitted)

minWidth

Any CSS min-width value e.g. minWidth="5rem".

Default: 0

maxWidth

Any CSS max-width value e.g. maxWidth="5rem".

Default: none

#### Example ```html ``` #### Accessibility information _"Image with [ratio] aspect ratio"_. ### `` The simplest of components: just wraps some content with some padding, and a border if you want it. #### Props
pad

Padding for all sides. A point on the modular scale (-5 to 10, or none) e.g. pad="2".

Default: 1

border

Whether to apply a border (Boolean)

Default: false (attribute omitted)

#### Example ```html

My box

``` #### Accessibility information _"['Bordered'?] box containing [# of child elements] elements"_ ### `` The `` component lets you inject whitespace between flow elements. Wrap it around a set of elements and separate them visually. Critically, it accepts a `repeat` prop that lets you multiply its contents a set number of times. #### Props
gap

A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: 1

repeat

The number of times the content (light DOM children) will be repeated. Can be an integer e.g. repeat="5" or a range e.g. repeat="5,10" (a random integer within the range is picked).

Default: 0 (no repetition)

lines

Boolean: Whether or not to divide items with horizontal lines/borders

Default: omitted (no lines)

#### Example ```html ``` #### Accessibility information _"Column of [# of child elements] elements"_ ### `` The `` element let's you easily compose a responsive grid using CSS's Grid algorithm. Like `` it lets you repeat the contents/children you supply. Useful for quickly mocking up a set of card components or similar. #### Props
gap

A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: 1

repeat

The number of times the content (light DOM children) will be repeated. Can be an integer e.g. repeat="5" or a range e.g. repeat="5,10" (a random integer within the range is picked).

Default: 0 (no repetition)

itemWidth

The 'ideal' width of the grid item as a CSS length value e.g. itemWidth="10ch". CSS Grid's auto-fit and minmax features ensure the layout is responsive.

Default: 15rem

#### Example ```html

Card title

``` #### Accessibility information _"Grid of [# of child elements] elements, each [itemWidth] wide"_ ### `` The `` component uses Flexbox to let you cluster items around the horizontal center of their context. Items wrap where there is no room for them all on one line, maintaining responsiveness. #### Props
gap

The gap between clustered items. A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: 1

align

Maps to the Flexbox align-items property. Choice of center (default), top (flex-start), or bottom (flex-end).

Default: center

#### Example ```html
Will Something on the left
Something in the center
something on the right
``` #### Accessibility information _"Set of [# of child elements] centrally grouped elements"_ ### `` The `` component uses Flexbox to let you separate items horizontally. Items wrap where there is no room for them all on one line, maintaining responsiveness. #### Props
gap

The minimum gap between spread-out items. A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: 1

spaces

Where the spaces occur. One of between (maps to justify-content: space-between) or around (maps to justify-content: space-around).

Default: between

align

Maps to the Flexbox align-items property. Choice of center (default), top (flex-start), or bottom (flex-end).

Default: center

#### Example ```html
Will be pushed to the left
Will appear in the center
Will be pushed to the right
``` ### `` The `` component wraps two child elements, with one as the designated 'sidebar' and the other taking up the remaining space. If more than two child elements are supplied, construction ceases and an error is returned. The designated sidebar only _appears_ as a sidebar where it is narrower than its sibling. Otherwise, Flexbox reorganizes the two elements into a single column (uses the `flex-grow: 999` hack). #### Props
gap

The gap between the sidebar and adjacent element. A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: none

width

The width of the sidebar in contexts wide enough that it can be a sidebar. Any CSS length, e.g. width="25rem".

Default: 20rem

to

Which child element (left or right) to be the sidebar. Values can only be 'left' or 'right'; If anything different is supplied, 'left' is used by default.

Default: left (omit the attribute)

#### Example Creates a sidebar of the second element (introduced with the `

` heading). The gap between the sidebar and the adjacent content matches the second point on the modular scale (one point higher than the default). ```html

The main content

The sidebar content

``` #### Accessibility information _"Content with a [left || right] sidebar"_ ### `` The `` component configures child elements inline, with the option to add a separator. The separator can be any character or HTML. #### Props
between

Some HTML to separate each item e.g. sep="·" or sep="|" (inline SVG can be used too!)

gap

A point on the modular scale (-5 to 10, or none) e.g. gap="2".

Default: 1

justify

Maps to the Flexbox justify-content property. One of left (flex-start), center (default), or right (flex-end).

Default: center

#### Example ```html Home About FAQ ``` #### Accessibility information _"Line of [# of child elements] elements"_ ### `` The `` component inserts an inline SVG icon, by name, from the **icons** folder (using fetch). The size of the icon is determined by its parent's `font-size`, or you can use the `u-h1` — `u-h6` utility classes on the `` itself. #### Props
name (required)

The name of the icon, matching the filename (without extension) from the icons folder.

label

A string to describe the SVG as an image. Not necessary if the icon has accompanying, descriptive text (for example, alongside a <button>'s text content).

Default: omitted (no label or image role)

#### Example ```html ``` #### Accessibility information None by default (it is assumed the icon will be accompanied by text). Or you can supply a label via the `label` prop. This will also include the `img` ARIA role. ### `` The `` component displays a series of steps in a continuum to indicate how far along the user is in a process. #### Props
steps (required)

A comma-separated set of labels for he consecutive steps, e.g. `steps="one,two,three"`.

current

The label of the current step, which takes aria-current="step" and a visual style to differentiate it from the other steps, e.g. current="two"

Default: the first step (whatever it is named)

#### Example ```html ``` #### Accessibility information _"Progress indicator of [# of steps] steps"_ (in addition to list semantics and `aria-current`). ### `` The `` component simply creates a centralized column (with horizontal margins set to `auto`). The `max-width` is set to the `--measure` custom property value (under **css/lib/variables.css**) by default. #### Props
maxWidth

A CSS max-width value e.g. 30ch.

Default: the root --measure value

#### Example ```html

A centrally aligned document section

``` #### Accessibility information NA ### `` A basic collapsible section, as you might find in an accordion. The first child (light DOM) element is use to form a button. This is wrapped in a heading, for which the level can be adjusted using the `level` prop. #### Props
level

An integer between 1 <h1> and 6 <h6> e.g. level="3".

Default: 2

open

An integer between 1 <h1> and 6 <h6> e.g. level="3".

#### Example ```html Collapsible section title

This content appears when the handle is clicked...

...and so does this content.

``` #### Accessibility information _"Collapsible section"_ ### `` The `` element lets you define whole screens (like those defined within a routed Single Page Application). You can link between screens using either the `` call-to-action component, or regular links pointing to hash fragments that match the screens' `id`s. The `` with the `index` `id` is displayed on page load. #### Props
id (required)

A valid id attribute value e.g. id="about".

label

A string describing the screen (think <title>) e.g. label="My App: Home page".

Default: the screen's id value

#### Example ```html

The default screen

About

The about screen

Home
``` #### Accessibility information The value of the label prop (or the id value as a fallback). ### `` A call-to-action type component, specifically for linking between `` elements. #### Props
to (required)

A valid id attribute value for a <s-creen> component e.g. to="index".

#### Example ```html Home ``` #### Accessibility information The text content of the link. ### `` The `` component lets you group elements as a navigable sequence of steps, such as sections in a form. On hover and focus, previous and next buttons are exposed to change steps. #### Props
hideControls

Boolean. Whether to show the previous and next buttons.

Default: false (attribute omitted)

#### Methods
prev()

Show the previous element

next()

Show the next element

goTo(index)

Show the element with the supplied index

#### Example ```html

Step 1

Step 2

Step 3

``` #### Accessibility information _"Sequence of [# of child elements] steps"_ ### `` Allows you to write a comment for any part of the interface, simply by wrapping it and supplying text for the `wording` prop. The comment is revealed by pressing a '?' button that is revealed on both hover and focus. #### Props
wording

A basic string e.g. wording="The main page content".

Default: 'TBD'

#### Example ```html

Card title

``` #### Accessibility information The comment wrapper is identified as a region. The buttons to open and close the comment are suitably labeled. ### `` The `` lets you instantiate content from a named `