How to Style the components #1126
-
I couldn't find any documentation about how to add custom style to the components. Are we able to add custom classes to components? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi! The main idea about Lion is that you should extend the component classes. There's an example here: Essentially we don't really expect people to use for example lion-input directly. You can, but the styling options will be limited, as we don't currently do anything special for CSS features like ::theme or ::part. The recommended way to use lion, in another example: import { css } from '@lion/core';
import { LionInput } from '@lion/input';
export class FooInput extends LionInput {
static get styles() {
return [
super.styles,
css`
/* your styles here */
`
];
}
} import { FooInput } from './src/FooInput.js';
customElements.define('foo-input', FooInput); I don't really think we will be doing much with |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. Is there also a way to add extend and add class's to the elements? One way I've found is to not extend and instead render the element. Is this approach ok or is there a better way? For context I'm looking to use the Lion classes in our own design system.
|
Beta Was this translation helpful? Give feedback.
Hi!
The main idea about Lion is that you should extend the component classes.
There's an example here:
https://lion-web-components.netlify.app/?path=/docs/intro-announcement--page#-extend-the-components
Essentially we don't really expect people to use for example lion-input directly. You can, but the styling options will be limited, as we don't currently do anything special for CSS features like ::theme or ::part.
The recommended way to use lion, in another example: