# Material shell gallery: every page > Every page of https://material.spynejs.com as Markdown, one after another. The index, and what each part of a page is: https://material.spynejs.com/llms.txt --- # Material shell gallery Source: https://material.spynejs.com/ Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt The gallery of the Material template for the SpyneJS Application Shell: Google's Material Design 3, built on SpyneJS's View, Behavior, Logic pattern. Every component and feature of the template has a page here, and every page says what an app model writes to ask for the thing. An app on the template is started with spyne-cli. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. Material Design for SpyneJS ### Build Material Design applications Google’s Material Design 3 for SpyneJS, on its View, Behavior, Logic pattern: applications that developers and agents can build together. - [Browse the components](https://material.spynejs.com/components.md) #### Start building spyne-cli now creates Material Design applications. One command starts one. ```bash npx spyne-cli create-app my-app ``` It asks three things: 1. Which template. Choose Application Shell. 2. “Use Material Design? (based on Google’s Material Design 3)” Answer Yes. 3. A description of your site. Describe it, and the application is generated for you in Material Design, with its pages, its navigation and placeholder photographs. Leave it empty for the template as it stands. To answer the first two without being asked: ```bash npx spyne-cli create-app my-app --template shell --material ``` This needs spyne-cli 0.8.0 or later. The components and transitions shown in this gallery come with the application you get. - [The template on GitHub](https://github.com/spynejs/application-shell-material) - [spyne-cli on npm](https://www.npmjs.com/package/spyne-cli) - [SpyneJS](https://spynejs.com/) #### What is in the gallery Every component and feature of the Material template for the SpyneJS Application Shell, on a page of its own. Each page shows the thing itself, the choices it has, and what an app model says to ask for it. The gallery is an app on the template, written the way a generated app is: its pages are page items in app.model.json. - [Colour roles](https://material.spynejs.com/foundations/color.md) - [Button](https://material.spynejs.com/components/buttons.md) - [Features](https://material.spynejs.com/features.md) - [Transitions](https://material.spynejs.com/transitions.md) --- # Foundations Source: https://material.spynejs.com/foundations Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt What every component is made from: colour, type, shape, elevation and motion. The values are Google's Material 3 tokens, read from Google's token package when the app is built, and each is a custom property an app's own styles can read. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. What every component is made from. The values come from Google's token package, read at build time. - [Colour](https://material.spynejs.com/foundations/color.md): The colour roles, in the scheme the app is showing. - [Type](https://material.spynejs.com/foundations/type.md): Fifteen styles, each plain and emphasized. - [Shape](https://material.spynejs.com/foundations/shape.md): Ten corners, from square to fully round. - [Elevation](https://material.spynejs.com/foundations/elevation.md): Six levels, each with its shadow. - [Motion](https://material.spynejs.com/foundations/motion.md): Ten easings and sixteen durations. --- # Colour Source: https://material.spynejs.com/foundations/color Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's colour roles. Every colour in the template is one of them, in a light and a dark scheme. A style reads a role by its custom property; a model does not choose colours. ## In an app model Nothing. A model does not choose colours. Every app on the template has the roles, in both schemes, and the visitor changes the scheme with the button in the header. ## The custom properties A role is a custom property named `--md-sys-color-` and then the role. A style of your own reads it with `var()`: ```css .my-note { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); } ``` - Content on a fill takes the fill’s own `on-` role: `on-primary` on `primary`, `on-surface` on any surface. That pairing is what keeps text readable in both schemes. - The page itself is `surface`. A surface set off from the page takes one of five container roles, from `surface-container-lowest` to `surface-container-highest`, each a step further from the page’s own. Content on any of them is `on-surface`; quieter content is `on-surface-variant`. - Write no colour value by hand. A role changes with the scheme; a typed value does not. - The roles are set on `main#app`, and again for the dark scheme on `main#app[data-theme='dark']`. - The Shell’s older names (`--brand`, `--paper`, `--text-muted` and the rest) still work: each is defined from a role. - Two roles the page does not show: `--md-sys-color-shadow`, the colour of a shadow, and `--md-sys-color-scrim`, the layer behind the open drawer. ## Where it is in the template | File | What it holds | By name | | --- | --- | --- | | `src/scss/00-spynejs-design-system/tokens/_material.scss` | reads Google’s tokens (`@material/web`) at build time; the only file that does | | | `src/scss/00-spynejs-design-system/theme/_light.scss` | the light scheme, and every token that does not change with the scheme | | | `src/scss/00-spynejs-design-system/theme/_dark.scss` | the dark scheme: only what differs | | | `src/scss/00-spynejs-design-system/theme/_bridge.scss` | the Shell’s own variable names, each defined from a role | | The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. ### Colour roles Every colour in the template is one of these roles. Each swatch is filled from the role's own custom property, so it is the colour the app is using now; the value beside it is read from the swatch. Change the colour scheme with the button in the header and the values follow. #### Primary The app's main colour: the filled button, the focused text field. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | primary | `--md-sys-color-primary` | #6750a4 | #d0bcff | | on-primary | `--md-sys-color-on-primary` | #ffffff | #381e72 | | primary-container | `--md-sys-color-primary-container` | #eaddff | #4f378b | | on-primary-container | `--md-sys-color-on-primary-container` | #4f378b | #eaddff | #### Secondary Less prominent components: the tonal button, the selected destination. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | secondary | `--md-sys-color-secondary` | #625b71 | #ccc2dc | | on-secondary | `--md-sys-color-on-secondary` | #ffffff | #332d41 | | secondary-container | `--md-sys-color-secondary-container` | #e8def8 | #4a4458 | | on-secondary-container | `--md-sys-color-on-secondary-container` | #4a4458 | #e8def8 | #### Tertiary A contrasting accent. The template does not use it yet. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | tertiary | `--md-sys-color-tertiary` | #7d5260 | #efb8c8 | | on-tertiary | `--md-sys-color-on-tertiary` | #ffffff | #492532 | | tertiary-container | `--md-sys-color-tertiary-container` | #ffd8e4 | #633b48 | | on-tertiary-container | `--md-sys-color-on-tertiary-container` | #633b48 | #ffd8e4 | #### Error An invalid field and the line of text under it. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | error | `--md-sys-color-error` | #b3261e | #f2b8b5 | | on-error | `--md-sys-color-on-error` | #ffffff | #601410 | | error-container | `--md-sys-color-error-container` | #f9dedc | #8c1d18 | | on-error-container | `--md-sys-color-on-error-container` | #8c1d18 | #f9dedc | #### Surfaces What everything stands on: the page, the cards, the app bar once the page has scrolled. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | surface | `--md-sys-color-surface` | #fef7ff | #141218 | | surface-dim | `--md-sys-color-surface-dim` | #ded8e1 | #141218 | | surface-bright | `--md-sys-color-surface-bright` | #fef7ff | #3b383e | | surface-container-lowest | `--md-sys-color-surface-container-lowest` | #ffffff | #0f0d13 | | surface-container-low | `--md-sys-color-surface-container-low` | #f7f2fa | #1d1b20 | | surface-container | `--md-sys-color-surface-container` | #f3edf7 | #211f26 | | surface-container-high | `--md-sys-color-surface-container-high` | #ece6f0 | #2b2930 | | surface-container-highest | `--md-sys-color-surface-container-highest` | #e6e0e9 | #36343b | #### Content and lines Text and icons on a surface, and the lines that divide it. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | on-surface | `--md-sys-color-on-surface` | #1d1b20 | #e6e0e9 | | on-surface-variant | `--md-sys-color-on-surface-variant` | #49454f | #cac4d0 | | outline | `--md-sys-color-outline` | #79747e | #938f99 | | outline-variant | `--md-sys-color-outline-variant` | #cac4d0 | #49454f | #### Inverse The snackbar. | Role | Custom property | Light | Dark | | --- | --- | --- | --- | | inverse-surface | `--md-sys-color-inverse-surface` | #322f35 | #e6e0e9 | | inverse-on-surface | `--md-sys-color-inverse-on-surface` | #f5eff7 | #322f35 | | inverse-primary | `--md-sys-color-inverse-primary` | #d0bcff | #6750a4 | --- # Type Source: https://material.spynejs.com/foundations/type Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's type scale: fifteen styles (display, headline, title, body and label, each large, medium and small), each plain and emphasized. The template gives every heading and every kind of text its style; a model does not choose type. ## In an app model Nothing. A model writes words; the template gives each kind of text its style. A heading takes the emphasized set and running text the plain one, as the table below shows. ## The custom properties A style is five custom properties, named `--md-sys-typescale-`, the style, and one of `font`, `size`, `line-height`, `weight`, `tracking`. The emphasized set has `emphasized-` before the style. Text of your own takes a style by setting all five: ```css .my-caption { font-family: var(--md-sys-typescale-body-small-font); font-size: var(--md-sys-typescale-body-small-size); line-height: var(--md-sys-typescale-body-small-line-height); font-weight: var(--md-sys-typescale-body-small-weight); letter-spacing: var(--md-sys-typescale-body-small-tracking); } ``` - Use the heading elements (`h1` to `h6`) and `p` as they are: each already has its style. - The typeface is Roboto, served by the app itself. No font is loaded from another site. ## Where it is in the template | File | What it holds | By name | | --- | --- | --- | | `src/scss/03-components/material/_type.scss` | which style each heading and each kind of text takes | | | `src/scss/00-spynejs-design-system/tokens/_material.scss` | the styles themselves, read from Google’s tokens | | | `src/scss/00-spynejs-design-system/tokens/_material-typeface.scss` | Roboto, in the weights Material uses | | The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. Material’s type scale: five kinds of text in three sizes. Each style is shown twice, plain and then emphasized, the heavier variant that the Expressive revision adds. Under each line are its size, line height, weight and letter spacing, read from the line itself. ### Display | Style | Used for | Plain | Emphasized | | --- | --- | --- | --- | | display-large | | 57px / 64px · weight 400 · spacing -0.25px | 57px / 64px · weight 500 · spacing -0.25px | | display-medium | Emphasized: the hero’s headline. | 45px / 52px · weight 400 · spacing normal | 45px / 52px · weight 500 · spacing normal | | display-small | Emphasized: a page’s first heading (h1). | 36px / 44px · weight 400 · spacing normal | 36px / 44px · weight 500 · spacing normal | ### Headline | Style | Used for | Plain | Emphasized | | --- | --- | --- | --- | | headline-large | The extra large button’s label. | 32px / 40px · weight 400 · spacing normal | 32px / 40px · weight 500 · spacing normal | | headline-medium | Emphasized: h2. | 28px / 36px · weight 400 · spacing normal | 28px / 36px · weight 500 · spacing normal | | headline-small | Emphasized: h3. The large button’s label. | 24px / 32px · weight 400 · spacing normal | 24px / 32px · weight 500 · spacing normal | ### Title | Style | Used for | Plain | Emphasized | | --- | --- | --- | --- | | title-large | Emphasized: h4, and a card’s title. Plain: the app bar’s title. | 22px / 28px · weight 400 · spacing normal | 22px / 28px · weight 500 · spacing normal | | title-medium | Plain: h5. The medium button’s label. | 16px / 24px · weight 500 · spacing 0.15px | 16px / 24px · weight 700 · spacing 0.15px | | title-small | Plain: h6. | 14px / 20px · weight 500 · spacing 0.1px | 14px / 20px · weight 700 · spacing 0.1px | ### Body | Style | Used for | Plain | Emphasized | | --- | --- | --- | --- | | body-large | Plain: running text. | 16px / 24px · weight 400 · spacing 0.5px | 16px / 24px · weight 500 · spacing 0.5px | | body-medium | Plain: small text, and a card’s supporting text. | 14px / 20px · weight 400 · spacing 0.25px | 14px / 20px · weight 500 · spacing 0.25px | | body-small | A text field’s label, once it has risen. | 12px / 16px · weight 400 · spacing 0.4px | 12px / 16px · weight 500 · spacing 0.4px | ### Label | Style | Used for | Plain | Emphasized | | --- | --- | --- | --- | | label-large | The small and extra small buttons’ labels. | 14px / 20px · weight 500 · spacing 0.1px | 14px / 20px · weight 700 · spacing 0.1px | | label-medium | | 12px / 16px · weight 500 · spacing 0.5px | 12px / 16px · weight 700 · spacing 0.5px | | label-small | | 11px / 16px · weight 500 · spacing 0.5px | 11px / 16px · weight 700 · spacing 0.5px | --- # Shape Source: https://material.spynejs.com/foundations/shape Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's ten corner radii. A component takes its corner from one of them by name; a model does not choose shape, but for a button's `shape` key. ## In an app model Nothing, with one exception: a button’s `shape` key (`round` or `square`), on the Button page. ## The custom properties A corner is a custom property named `--md-sys-shape-corner-` and then its name: ```css .my-panel { border-radius: var(--md-sys-shape-corner-medium); } ``` ## Where it is in the template | File | What it holds | By name | | --- | --- | --- | | `src/scss/00-spynejs-design-system/tokens/_material.scss` | the corners, read from Google’s tokens | | The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. The corner radii. A component takes its corner from one of these by name. Each square below has that corner, and its value is read from the page. ### Corners Full is a radius large enough to round any side completely. | Token | Custom property | Value | | --- | --- | --- | | corner-none | `--md-sys-shape-corner-none` | 0px | | corner-extra-small | `--md-sys-shape-corner-extra-small` | 4px | | corner-small | `--md-sys-shape-corner-small` | 8px | | corner-medium | `--md-sys-shape-corner-medium` | 12px | | corner-large | `--md-sys-shape-corner-large` | 16px | | corner-large-increased | `--md-sys-shape-corner-large-increased` | 20px | | corner-extra-large | `--md-sys-shape-corner-extra-large` | 28px | | corner-extra-large-increased | `--md-sys-shape-corner-extra-large-increased` | 32px | | corner-extra-extra-large | `--md-sys-shape-corner-extra-extra-large` | 48px | | corner-full | `--md-sys-shape-corner-full` | 9999px | --- # Elevation Source: https://material.spynejs.com/foundations/elevation Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's six elevation levels. A level is a height; the template works out the shadow for it when the app is built. A model does not choose elevation. ## In an app model Nothing. Which level a thing stands at follows from what it is: a section’s surface is an elevated card, the app bar rises once the page has scrolled, a snackbar stands above the page. ## In a style A level’s height is the custom property `--md-sys-elevation-level0` to `--md-sys-elevation-level5`. The height is not a shadow. The shadow for a level comes from a Sass function in the template’s token file, used where a style is written: ```scss @use '../../00-spynejs-design-system/tokens/material'; .my-panel { box-shadow: material.elevation-shadow(2); } ``` - The path in `@use` is from a file in `src/scss/03-components/material/`; from another folder it changes. - The shadow’s colour is the role `--md-sys-color-shadow`. In the dark scheme a shadow shows much less; that is how Material has it. - A card inside a section is outlined and casts no shadow, so that a card never casts a shadow onto a card. ## Where it is in the template | File | What it holds | By name | | --- | --- | --- | | `src/scss/00-spynejs-design-system/tokens/_material.scss` | the levels, and the function that works out a level’s shadow | `elevation-shadow` | The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. How far a surface stands above the page. Material’s token for a level is only a height. The template works the shadow out from that height when it is built, by the same arithmetic as Google’s own elevation element. ### Levels The value under each is the level’s height. In the dark scheme a shadow shows much less; that is how Material has it. | Token | Custom property | Value | | --- | --- | --- | | level0 | `--md-sys-elevation-level0` | 0px | | level1 | `--md-sys-elevation-level1` | 1px | | level2 | `--md-sys-elevation-level2` | 3px | | level3 | `--md-sys-elevation-level3` | 6px | | level4 | `--md-sys-elevation-level4` | 8px | | level5 | `--md-sys-elevation-level5` | 12px | --- # Motion Source: https://material.spynejs.com/foundations/motion Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's ten easings and sixteen durations. The template's own moves use them; a model does not choose motion. ## In an app model Nothing. How a thing moves follows from what it is and from the move being made. The moves between pages are on the Transitions page. ## The custom properties An easing is `--md-sys-motion-easing-` and its name; a duration is `--md-sys-motion-duration-` and its name: ```css .my-panel { transition: opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard-decelerate); } ``` - Material uses a decelerate easing for what arrives and an accelerate easing for what leaves. - Whatever you make slide, grow or shrink, give it a rule for `@media (prefers-reduced-motion: reduce)`: a fade in its place. A thing that only fades needs none. See the Reduced motion page. - Material’s Expressive set also has springs. CSS has nothing that takes them, so the template does not carry them. ## Where it is in the template | File | What it holds | By name | | --- | --- | --- | | `src/scss/00-spynejs-design-system/tokens/_material.scss` | the easings and durations, read from Google’s tokens | | | `src/scss/03-components/material/_motion.scss` | the moves between pages, which use them | | The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. How long a change takes, and how it speeds up and slows down. The switch over each list moves its markers to the far end, and back again when it is turned off. The Expressive set also has springs; CSS has nothing that takes them, so the template does not carry them. ### Easings Every marker takes one second, so that its curve can be seen. Switch: Move the markers | Token | Custom property | Value | | --- | --- | --- | | easing-emphasized | `--md-sys-motion-easing-emphasized` | cubic-bezier(0.2, 0, 0, 1) | | easing-emphasized-decelerate | `--md-sys-motion-easing-emphasized-decelerate` | cubic-bezier(0.05, 0.7, 0.1, 1) | | easing-emphasized-accelerate | `--md-sys-motion-easing-emphasized-accelerate` | cubic-bezier(0.3, 0, 0.8, 0.15) | | easing-standard | `--md-sys-motion-easing-standard` | cubic-bezier(0.2, 0, 0, 1) | | easing-standard-decelerate | `--md-sys-motion-easing-standard-decelerate` | cubic-bezier(0, 0, 0, 1) | | easing-standard-accelerate | `--md-sys-motion-easing-standard-accelerate` | cubic-bezier(0.3, 0, 1, 1) | | easing-legacy | `--md-sys-motion-easing-legacy` | cubic-bezier(0.4, 0, 0.2, 1) | | easing-legacy-decelerate | `--md-sys-motion-easing-legacy-decelerate` | cubic-bezier(0, 0, 0.2, 1) | | easing-legacy-accelerate | `--md-sys-motion-easing-legacy-accelerate` | cubic-bezier(0.4, 0, 1, 1) | | easing-linear | `--md-sys-motion-easing-linear` | cubic-bezier(0, 0, 1, 1) | ### Durations Every marker takes its own duration, on the standard easing. Switch: Move the markers | Token | Custom property | Value | | --- | --- | --- | | duration-short1 | `--md-sys-motion-duration-short1` | 50ms | | duration-short2 | `--md-sys-motion-duration-short2` | 100ms | | duration-short3 | `--md-sys-motion-duration-short3` | 150ms | | duration-short4 | `--md-sys-motion-duration-short4` | 200ms | | duration-medium1 | `--md-sys-motion-duration-medium1` | 250ms | | duration-medium2 | `--md-sys-motion-duration-medium2` | 300ms | | duration-medium3 | `--md-sys-motion-duration-medium3` | 350ms | | duration-medium4 | `--md-sys-motion-duration-medium4` | 400ms | | duration-long1 | `--md-sys-motion-duration-long1` | 450ms | | duration-long2 | `--md-sys-motion-duration-long2` | 500ms | | duration-long3 | `--md-sys-motion-duration-long3` | 550ms | | duration-long4 | `--md-sys-motion-duration-long4` | 600ms | | duration-extra-long1 | `--md-sys-motion-duration-extra-long1` | 700ms | | duration-extra-long2 | `--md-sys-motion-duration-extra-long2` | 800ms | | duration-extra-long3 | `--md-sys-motion-duration-extra-long3` | 900ms | | duration-extra-long4 | `--md-sys-motion-duration-extra-long4` | 1000ms | --- # Components Source: https://material.spynejs.com/components Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt The Material components the template has, one page each: what the thing is, the choices it has, and what an app model writes to ask for it. In the template a component is not something to import: it is plain markup with classes, drawn from the model. ## As the page shows it The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out. One page for each. A component’s page shows the thing itself, the choices it has, and what an app model says to ask for it. - [Button](https://material.spynejs.com/components/buttons.md): Five variants, five sizes, two shapes. - [Card](https://material.spynejs.com/components/cards.md): A card that links, and the surface it sits on. - [Text field](https://material.spynejs.com/components/text-fields.md): The outlined field, its floating label and its error line. - [Snackbar](https://material.spynejs.com/components/snackbar.md): A brief report that leaves by itself. - [Top app bar](https://material.spynejs.com/components/app-bar.md): The header, at the top and scrolled. - [Navigation drawer](https://material.spynejs.com/components/drawer.md): The app’s destinations, in a panel at the side. - [From a model](https://material.spynejs.com/components/from-a-model.md): The ruled keys at work, in the Shell’s own page items. --- # Button Source: https://material.spynejs.com/components/buttons Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt Material's common button, in five variants, five sizes and two shapes. In an app on the Material template a button is not a component you import: it is the class `btn` with classes for its look, and an app model asks for the look with a `button` key. ## In an app model A call to action says how its button looks in a `button` key beside its words: ```json { "ctaText": "Order ahead", "attrCtaHref": "/order", "button": { "variant": "tonal", "size": "md", "shape": "square" } } ``` | Key of `button` | Values | Left out | | --- | --- | --- | | `variant` | `filled`, `tonal`, `outlined`, `elevated`, `text` | `filled` | | `size` | `xs`, `sm`, `md`, `lg`, `xl` | `sm` | | `shape` | `round`, `square` | `round` | - Write only what is not a default. With the whole look at its defaults, leave `button` out. - With no `button` key the button is written `btn btn-primary`, which draws as the filled button at the small size. - A `button` key with nothing in it, or with only defaults in it, is written `btn btn-filled btn-sm`. That draws the same. - The key is read where a call to action is: a page’s `hero`, a call-to-action banner (`cta-banner.tmpl.html`), each row of a split feature (`split-feature.tmpl.html`), and the contact form’s data beside `formFields`. - A model does not say whether a button is disabled. - To have no button, give `ctaText` no words (`""`). A call to action with no words has no button drawn. - The contact form’s button has no `ctaText`. Its words, “Send Message”, are in the form’s template. ## The classes `btn`, then one class for the variant, one for the size, and `btn-square` for the square shape: ``` btn btn-tonal btn-md btn-square ``` | Choice | Classes | | --- | --- | | Variant | `btn-filled`, `btn-tonal`, `btn-outlined`, `btn-elevated`, `btn-text` | | Size | `btn-xs`, `btn-sm`, `btn-md`, `btn-lg`, `btn-xl` | | Shape | `btn-square` (round needs no class) | - A template of your own can write these classes directly on an `` or a `