### Install Project Dependencies
Source: https://github.com/telekom/scale/blob/main/examples/telekom-header-samples/application-name/README.md
Installs all necessary dependencies for the project. Run this after cloning the repository.
```bash
npm install
```
--------------------------------
### Install with NPM
Source: https://github.com/telekom/scale/blob/main/packages/design-tokens/README.md
Install the Scale component library using NPM. This is the recommended method for most projects.
```bash
npm install @telekom/scale-components
```
--------------------------------
### Start Development Server
Source: https://github.com/telekom/scale/blob/main/examples/nuxt3-boilerplate/README.md
Starts the Nuxt 3 development server, typically accessible at http://localhost:3000.
```bash
npm run dev
```
--------------------------------
### Start Development Server
Source: https://github.com/telekom/scale/blob/main/examples/telekom-header-samples/application-name/README.md
Starts a local development server with hot-reloading enabled. This command is used for active development.
```bash
npm run start
```
--------------------------------
### Setup Scale Components with Plain HTML
Source: https://github.com/telekom/scale/blob/main/README.md
Include the Scale components CSS and JavaScript files in your HTML for basic setup. This method is suitable for projects not using a bundler.
```html
```
--------------------------------
### Install Dependencies
Source: https://github.com/telekom/scale/blob/main/examples/nuxt3-boilerplate/README.md
Installs project dependencies using yarn, npm, or pnpm.
```bash
# yarn
yarn install
# npm
npm install
# pnpm
pnpm install --shamefully-hoist
```
--------------------------------
### Start Gatsby Development Server
Source: https://github.com/telekom/scale/blob/main/examples/gatsby-ssr/README.md
Navigate into your new site's directory and start the development server. This command allows you to see your site in the browser and hot-reloads changes.
```shell
cd my-default-starter/
gatsby develop
```
--------------------------------
### ScaleChip Interactive Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/chip/Chip.stories.mdx
Interactive example demonstrating dynamic chip dismissal and selection management. Chips are dismissable and selection is managed externally.
```javascript
export const TemplateInteractive = (args, { argTypes }) => ({
components: { ScaleChip },
template: `
Dismisable options:
{{chipLabel}}
`,
methods: {
removeChip(label) {
action('scale-close')(label);
this.labels = this.labels.filter(l => l !== label);
this.selectedChip = this.labels[0];
this.$nextTick(() => {
const firstChip = this.$el.querySelector('ul > li > scale-chip');
if (firstChip && firstChip.shadowRoot) {
const button = firstChip.shadowRoot.querySelector('span > button');
if (button) button.focus();
}
});
},
},
data: () => ({
labels: ['option 1', 'option 2', 'option 3', 'option 4'],
selectedChip: 'option 1'
}),
});
```
--------------------------------
### Install with NPM
Source: https://github.com/telekom/scale/blob/main/README.md
Install the latest version of the Scale component library using NPM. For versions prior to dark mode support, omit the '@next' tag.
```bash
npm install @telekom/scale-components@next
```
--------------------------------
### Install Neutral Components with NPM
Source: https://github.com/telekom/scale/blob/main/packages/design-tokens/README.md
Install the neutral components package using NPM to begin customizing Scale for open source use.
```bash
npm install @telekom/scale-components-neutral
```
--------------------------------
### Link Component Setup
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/link/Link.stories.mdx
This snippet shows the basic setup for the Link component within Storybook, including Meta information and the template function for rendering.
```javascript
import { Meta, Story, ArgsTable, Canvas } from '@storybook/addon-docs';
import ScaleLink from './ScaleLink.vue';
export const Template = (args) => ({
props: {
label: String,
...ScaleLink.props,
},
template: `
{{ label }}
`,
});
```
--------------------------------
### Toast Stack Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/notification/Notification.stories.mdx
Demonstrates how to stack multiple toast notifications using a container with the `.scl-toast-stack` class. This example includes dynamic creation of toasts with customizable delay and variants.
```html
Lorem ipsum dolor sit amet, consetetur tempordede invidunt ut labore et dolore.
```
--------------------------------
### Basic Combobox Setup
Source: https://github.com/telekom/scale/blob/main/packages/components/src/html/combobox.html
Sets up a basic combobox with a list of framework options and logs the selected value on change.
```javascript
const frameworks = [
'React',
'Vue',
'Angular',
'Svelte',
'Ember',
'Next.js',
'Nuxt',
'Gatsby',
];
const basicCombobox = document.getElementById('basic-combobox');
basicCombobox.options = frameworks;
basicCombobox.addEventListener('scaleChange', (e) => {
console.log('Basic combobox changed:', e.detail.value);
});
```
--------------------------------
### Start Development Mode
Source: https://github.com/telekom/scale/blob/main/packages/components/README.md
Launches the project in development mode, enabling live reloading and other development-specific features.
```bash
yarn start
```
--------------------------------
### Basic Callout Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/callout/Callout.stories.mdx
A basic example of the scale-callout component with black variant. Use this for general information display.
```html
Up to 200 €Exchange premium +
receive old appliancevalue *
```
--------------------------------
### Install Neutral Scale Components with NPM
Source: https://github.com/telekom/scale/blob/main/README.md
Use this command to install the latest neutral theme components for Scale. For versions prior to dark mode support, omit the '@next' tag.
```bash
npm install @telekom/scale-components-neutral@next
```
--------------------------------
### Profile Menu Logged In Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/telekom-brand-header-navigation/TelekomBrandHeader.stories.mdx
Demonstrates the configuration of the profile menu for a logged-in user with various service links and user information. This example is typically used within a Storybook canvas.
```javascript
import { html } from "lit-html";
const TemplateProfileMenu = (args) => html`
`;
export const ProfileMenuStory = TemplateProfileMenu.bind({});
ProfileMenuStory.args = {
loginSettingsUrl: "https://www.telekom.de/todo/loginSettings",
hideLoginSettings: false,
logoutUrl: "https://www.telekom.de/todo/logout",
loggedIn: true,
appName: "Application",
label: "Alexander",
accessibilityLabel: "open user menu: Alexander",
closeMenuAccessibilityLabel: "close menu",
loginSettingsLabel: "Login Settings",
logoutLabel: "Log out",
userInfo: JSON.stringify({
name: 'Alexander Dreyer',
email: 'alexander.dreyer@t-online.de',
}),
serviceLinks: JSON.stringify([
{
name: 'My Account',
href: 'https://www.telekom.de/mein-kundencenter',
icon: 't-product-measure-internet-speed',
},
{
name: 'E-Mail Center',
href: 'https://www.telekom.de/e-mail/e-mail-center',
icon: 'communication-mail-opened',
},
{
name: 'MagentaTV',
href: 'https://web.magentatv.de/EPG/',
icon: 't-product-magenta-tv',
},
{
name: 'MagentaSport',
href: 'https://www.magentasport.de',
icon: 't-product-telekom-1t1',
},
{
name: 'MagentaCLOUD',
href: 'https://magentacloud.de',
icon: 'action-upload-to-cloud',
},
{
name: 'MagentaHome Web',
href: 'https://cockpit.telekom.net',
icon: 'home-smarthome',
}
])
};
```
--------------------------------
### Interactive Progress Bar Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/progress-bar/ProgressBar.stories.mdx
Provides an interactive example of the ScaleProgressBar component, allowing users to trigger success or failure states and observe progress. This is useful for testing dynamic behavior.
```javascript
export const TemplateInteractive = (args, { argTypes }) => ({
components: { ScaleProgressBar },
template:
`
Start SuccessStart FailureReset
`,
methods: {
startSuccess() {
this.reset();
this.start('success');
},
startFailure() {
this.reset();
this.start('failure');
},
start(outcome) {
const max = outcome === 'success' ? 100 : 42
this.interval = setInterval(() => {
if (this.$data.percentage === max) {
clearInterval(this.interval);
this.$data.state = outcome;
this.interval = null;
return;
}
this.$data.percentage += 1;
}, 40);
},
reset() {
clearInterval(this.interval);
this.interval = null;
this.$data.state = 'initial';
this.$data.percentage = 0;
},
},
data: () => ({
interval: null,
success: {
statusDescription: 'Upload complete',
},
failure: {
hasError: true,
statusDescription: 'Upload failed',
},
initial: {
showStatus: true,
},
percentage: 0,
state: 'initial',
busy: false,
}),
});
```
--------------------------------
### Standard Dropdown Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/dropdown/DropDown.stories.mdx
Demonstrates the basic structure of a dropdown component with options. Includes a pre-selected item.
```html
```
--------------------------------
### Standard Link Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/link/Link.stories.mdx
Demonstrates a standard link with a label and href. This is the default configuration for the Link component.
```html
A link
```
--------------------------------
### Install Scale React Proxy Package
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/setup_and_info/ScaleAndReact_en.md
Install the dedicated React proxy package for Scale components. This package provides React-specific wrappers for easier integration.
```bash
npm install @telekom/scale-components-react@next
```
--------------------------------
### Menu Direction Examples
Source: https://github.com/telekom/scale/blob/main/packages/components/src/html/menu.html
Demonstrates how the menu can be positioned in different directions relative to its trigger.
```html
RightI'm Over HereYesMe TooMe ThreeTop RightI'm Over HereYesMe TooMe ThreeBottom RightI'm Over HereYesMe TooMe ThreeBottom LeftI'm Over HereYesMe TooMe ThreeTop LeftI'm Over HereYesMe TooMe ThreeLeftI'm Over HereYesMe TooMe Three
```
--------------------------------
### Tooltip Trigger Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/tooltip/Tooltip.stories.mdx
Demonstrates how to trigger a tooltip using the 'focus' event. This is useful for accessibility.
```html
Focus me
```
--------------------------------
### Cascading Menu Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/flyout-menu/MenuFlyout.stories.mdx
Demonstrates a complex cascading menu structure with nested submenus, items with prefixes and suffixes, and dividers. This example shows how to integrate the menu flyout with a button trigger and handle various menu interactions.
```html
Item TitleReally Quite Long Item TitleItem With Suffix 1⌘FItem With Suffix 2⌘H
Other Options
Item With Prefix 1
Item
With Prefix 2
Third Level Item 1Third Level Item 2Third Level Item 3Item
With Prefix 3
```
--------------------------------
### Standard Notification Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/notification/Notification.stories.mdx
Demonstrates how to render a standard notification with a heading, dismissible option, and content slot.
```html
Lorem ipsum dolor sit amet, consetetur tempordede invidunt ut labore et dolore.
```
--------------------------------
### Disabled Link Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/link/Link.stories.mdx
Shows how to render a link in a disabled state. Disabled links are not interactive.
```html
A link, disabled
```
--------------------------------
### Pagination Component Setup
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/pagination/Pagination.stories.mdx
Sets up the ScalePagination component with its props for use in Storybook. This template allows for dynamic prop configuration.
```javascript
import { Meta, Story, ArgsTable, Canvas } from '@storybook/addon-docs';
import ScalePagination from './ScalePagination.vue';
export const Template = (args, { argTypes }) => ({
components: { ScalePagination },
props: {
...ScalePagination.props,
},
template: `
`,
});
```
--------------------------------
### Cascading Menu Example
Source: https://github.com/telekom/scale/blob/main/packages/components/src/html/menu.html
Demonstrates a menu with sub-menus (cascading menus). Use nested `scale-menu-item` elements to create sub-menus.
```html
Item 1
More Options
Option 1Option 2
Option 3
Very Specific OptionsOption 1Option 2Option 3Toggle Visibility
Column 1
Column 2Column 3Column 4Column 5Item 5 ⌘Space
```
--------------------------------
### Tooltip Component Setup
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/tooltip/Tooltip.stories.mdx
Defines the Storybook metadata and component properties for the Scale Tooltip. Includes controls for content, placement, and other behaviors.
```javascript
import {
Meta,
Story,
ArgsTable,
Canvas,
Description,
} from '@storybook/addon-docs';
import ScaleTooltip from './ScaleTooltip.vue';
export const Template = (args, { argTypes }) => ({
components: { ScaleTooltip },
props: {
...ScaleTooltip.props,
},
template: `
`,
});
```
--------------------------------
### Divider Component Setup
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/divider/Divider.stories.mdx
Sets up the Meta and Template for the Divider component in Storybook, including import statements and component registration.
```javascript
import {
Meta,
Story,
ArgsTable,
Canvas,
Description,
} from '@storybook/addon-docs';
import ScaleDivider from './ScaleDivider.vue';
export const ICON =
'M16.471,8.321 L12.613594,0.502886112 L8.755,8.321 L0.126435258,9.57533801 L6.37,15.66 L4.89610548,24.2548735 L12.613,20.197 L20.3310826,24.2548735 L18.856,15.66 L25.1007528,9.57533801 L16.471,8.321 Z M9.41891527,9.23556376 L12.613,2.761 L15.8082728,9.23556376 L22.951,10.273 L17.7826928,15.3122039 L19.003,22.427 L12.613594,19.067774 L6.223,22.427 L7.44449521,15.3122039 L2.275,10.273 L9.41891527,9.23556376 Z';
export const Template = (args, { argTypes }) => ({
components: { ScaleDivider },
props: ScaleDivider.props,
template:
`
`,
});
```
--------------------------------
### Setup with Plain HTML
Source: https://github.com/telekom/scale/blob/main/README.md
Include the Scale component library's CSS and JavaScript modules in your HTML file. This method is suitable for projects not using a bundler.
```html
```
--------------------------------
### Create a New Gatsby Site with Default Starter
Source: https://github.com/telekom/scale/blob/main/examples/gatsby-ssr/README.md
Use the Gatsby CLI to create a new site, specifying the default starter. This command initializes a new project with the default Gatsby configuration files.
```shell
gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
```
--------------------------------
### Setup with Bundler or ES Modules
Source: https://github.com/telekom/scale/blob/main/packages/components/README.md
Import the Scale component library's CSS and define custom elements when using a bundler or ES modules.
```javascript
import "@telekom/scale-components/dist/scale-components/scale-components.css";
import { defineCustomElements } from "@telekom/scale-components/loader";
defineCustomElements();
```
--------------------------------
### Telekom Mega Menu Column Usage Example
Source: https://github.com/telekom/scale/blob/main/packages/components/src/components/telekom/telekom-mega-menu/readme.md
This is a basic usage example of the scale-telekom-mega-menu-column component. It demonstrates how to include an icon, a heading, and a list of links within the column.
```html
My heading
```
--------------------------------
### Card With Link Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/card/Card.stories.mdx
Shows how to configure a card to act as a link, including the target URL and attributes for secure linking. This is useful for cards that navigate to external resources.
```html
Lorem ipsur dolor sit amet
```
--------------------------------
### Preview Production Build
Source: https://github.com/telekom/scale/blob/main/examples/nuxt3-boilerplate/README.md
Locally previews the production build of the Nuxt 3 application.
```bash
npm run preview
```
--------------------------------
### Card With Image Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/card/Card.stories.mdx
Illustrates embedding an image within a card, along with a title and text content, and linking it to an external URL. This example demonstrates a richer card content structure.
```html
Blogpost Title
Lorem ipsur dolor sit amet
```
--------------------------------
### ScaleSlider Component Setup
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/slider/Slider.stories.mdx
This snippet shows the basic setup for the ScaleSlider component within a Storybook template. It includes importing necessary components and defining the template with various props and event handlers.
```javascript
import {
Meta,
Story,
ArgsTable,
Canvas,
Description,
} from '@storybook/addon-docs';
import ScaleSlider from './ScaleSlider.vue';
import { action } from '@storybook/addon-actions';
**[DEPRECATED]** (optional) slider custom color
',
},
thumbLarge :{
description: ' **[DEPRECATED]** (optional) larger thumb
',
},
decimals :{
description: ' (optional) number of decimal places ',
},
innerAriaValueText :{
description: ' (optional) Aria label for range slider',
},
label :{
description: ' (optional) slider label',
},
max :{
description: ' (optional) the maximal value of the slider',
},
min :{
description: ' (optional) he minimal value of the slider',
},
name :{
description: ' (optional) the name of the slider',
},
range :{
description: ' (optional) multi-thumb',
},
showStepMarks :{
description: ' (optional) show a mark for each step',
},
showValue :{
description: ' (optional) slider display value',
},
sliderId :{
description: ' (optional) Slider id',
},
step :{
description: ' (optional) the step size to increase or decrease when dragging slider',
},
unit :{
description: ' (optional) slider value unit',
},
unitPosition :{
description: ' (optional) unit position',
},
helperText :{
description: ' (optional) helper text',
},
disabled :{
description: ' (optional) disabled',
},
value :{
description: ' (optional) the value of the slider',
},
valueTo :{
description: ' (optional) when `range` is true, the "from" value',
},
valueFrom :{
description: ' (optional) when `range` is true, the "to" value',
},
}}
/>
export const Template = (args, { argTypes }) => ({
props: {
...ScaleSlider.props,
},
template: `
`,
methods: {
handleScaleChange: action('scale-change'),
handleScaleInput: action('scale-input'),
},
});
```
--------------------------------
### Generate Table Head for Typography
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/guidelines/Typography.stories.mdx
Generates the table header for displaying typography examples, including columns for Example, Description, and Token. It dynamically adjusts border styles based on the dark mode setting.
```javascript
function generateTableHead() {
return (
Example
Description
Token
);
}
```
--------------------------------
### Basic Icon Usage
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/icon/Icon.stories.mdx
Demonstrates how to use a specific icon component with defined properties like fill color, size, selection state, and accessibility title.
```html
```
--------------------------------
### Scale Button Disabled State
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/button/Button.stories.mdx
Example of a disabled scale-button component.
```html
Label
```
--------------------------------
### Setup with ES Modules and Bundlers
Source: https://github.com/telekom/scale/blob/main/README.md
Import the Scale component library's CSS and define custom elements using JavaScript. This is the recommended approach for modern JavaScript projects using bundlers or ES modules.
```javascript
import "@telekom/scale-components/dist/scale-components/scale-components.css";
import { defineCustomElements } from "@telekom/scale-components/loader";
defineCustomElements(window);
```
--------------------------------
### Disabled Combobox Setup
Source: https://github.com/telekom/scale/blob/main/packages/components/src/html/combobox.html
Initializes a disabled combobox with three options.
```javascript
const disabledCombobox = document.getElementById('disabled-combobox');
disabledCombobox.options = ['Option 1', 'Option 2', 'Option 3'];
```
--------------------------------
### Badge Component Usage
Source: https://github.com/telekom/scale/blob/main/packages/components/src/components/badge/readme.md
Example of how to use the scale-badge component with a count and a label.
```html
```
--------------------------------
### Date Range Picker Initialization and Event Handling
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/date-picker/DatePicker.stories.mdx
Initializes two date picker components and sets up event listeners to manage the date range. It ensures the end date's minimum is set to the start date and vice versa, and automatically shows the end date picker after a start date is selected.
```html
```
--------------------------------
### TelekomFooter Data API Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/telekom-footer/TelekomFooter.stories.mdx
Demonstrates the usage of the TelekomFooterDataBackCompat component with specific props for type and copyright. It also shows how to dynamically set the footerNavigation property after the component is mounted.
```html
```
--------------------------------
### Scale Button Ghost Variant
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/button/Button.stories.mdx
Example of using the ghost variant of the scale-button component.
```html
Label
```
--------------------------------
### Scale Button Secondary Variant
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/button/Button.stories.mdx
Example of using the secondary variant of the scale-button component.
```html
Label
```
--------------------------------
### Disabled Tooltip Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/tooltip/Tooltip.stories.mdx
Illustrates how to disable the tooltip component. The tooltip will not appear even when interacted with.
```html
Hover me
```
--------------------------------
### Build for Production
Source: https://github.com/telekom/scale/blob/main/examples/nuxt3-boilerplate/README.md
Builds the Nuxt 3 application for production deployment.
```bash
npm run build
```
--------------------------------
### Preselected Tab Example
Source: https://github.com/telekom/scale/blob/main/packages/storybook-vue/stories/components/tab-navigation/TabNav.stories.mdx
Demonstrates how to set a tab as preselected by adding the 'selected' attribute to the scale-tab-header.
```html
General
Freegan kinfolk farm-to-table humblebrag cred
Usage
Bespoke austin pork belly yuccie pop-up. Before they sold out
Style
Biodiesel chia af hoodie tumeric bespoke letterpress
Code
Asymmetrical tattooed chia, banh mi blog microdosing
```