Official website: https://tegel.scania.com/
Storybook: https://tds-storybook.tegel.scania.com/
The design system supports the design and development of digital solutions at Scania. The purpose is to secure a coherent, premium brand and user experience across all of Scania's digital touchpoints.
This package is currently considered a beta. Version 1.0.0 and later are released, and we see no braking changes coming in near future.
- Run
npm install @scania/tegel
- src folder create a file called
register-webcomponents.ts
- Paste the following into that file:
import { defineCustomElements, JSX as LocalJSX } from '@scania/tegel/loader';
import { DetailedHTMLProps, HTMLAttributes } from 'react';
type StencilProps<T> = {
[P in keyof T]?: Omit<T[P], 'ref'> | HTMLAttributes<T>;
};
type ReactProps<T> = {
[P in keyof T]?: DetailedHTMLProps<HTMLAttributes<T[P]>, T[P]>;
};
type StencilToReact<T = LocalJSX.IntrinsicElements, U = HTMLElementTagNameMap> = StencilProps<T> &
ReactProps<U>;
declare global {
export namespace JSX {
interface IntrinsicElements extends StencilToReact {}
}
}
defineCustomElements(window);
- In your index.tsx import
register-webcomponents.ts
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import './register-webcomponents';
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
reportWebVitals();
- In your global css file (usually
App.css
) import the tegel stylesheet.
@import url('@scania/tegel/dist/tegel/tegel.css');
- Run
npm install @scania/tegel
- In your index.jsx define the custom components:
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { defineCustomElements } from '@scania/tegel/loader';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
reportWebVitals();
defineCustomElements();
- In your global css file (usually
App.css
) import the tegel stylesheet.
@import url('@scania/tegel/dist/tegel/tegel.css');
- Run
npm install @scania/tegel
- In your
main.ts
import and call the functiondefineCustomElements()
:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { defineCustomElements } from '@scania/tegel/loader';
import { AppModule } from './app/app.module';
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch((err) => console.error(err));
defineCustomElements(window);
- In your
app.module.ts
importCUSTOM_ELEMENTS_SCHEMA
:
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
providers: [],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
- In your global css file (
styles.css
) import the tegel stylesheet.
@import url('@scania/tegel/dist/tegel/tegel.css');
- Run
npm init
to generate a package.json - Run
npm install @scania/tegel
- Import the package and its style in your
<head>
:
<script type="module">
import { defineCustomElements } from './node_modules/@scania/tegel/loader/index.es2017.js';
defineCustomElements();
</script>
<link rel="stylesheet" href="./node_modules/@scania/tegel/dist/tegel/tegel.css" />
See all available components in the Tegel Design System.
See the browser support section on the Tegel website.
Get in touch with the team and the community:
All CSS, HTML and JS code are available under the MIT license. The Scania brand identity, logos and photographs found in this repository are copyrighted Scania CV AB and are not available on an open source basis or to be used as examples or in any other way, if not specifically ordered by Scania CV AB.