Skip to content

How to use the design system in react or other frameworks? #5186

Answered by asyncLiz
futornoi asked this question in Q&A
Discussion options

You must be logged in to vote

Better React docs and helpers are on our todo list, but until then it takes a bit of setup.

I'd recommend reading through https://lit.dev/docs/frameworks/react/ to start with. The tl;dr is to use @lit-labs/react to build wrapper React components, then use those.

import React from 'react';
import {createComponent} from '@lit/react';
import {MdFilledButton as MdFilledButtonWebComponent} from '@material/web/button/filled-button.js';

export const MdFilledButton = createComponent({
  tagName: 'md-filled-button',
  elementClass: MdFilledButtonWebComponent,
  react: React,
});
import {MdFilledButton} from './wrappers/md-filled-button';

export function MyApp() {
  return <MdFilledButton>Button</M…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@denkochev
Comment options

@stefdude1999
Comment options

@asyncLiz
Comment options

Answer selected by futornoi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants