Component CSS File

A component can include a CSS file. Use standard CSS syntax to style Lightning web components.

To style a component, create a stylesheet in the component bundle with the same name as the component. If the component is called myComponent, the style sheet is myComponent.css. The stylesheet is applied automatically.

A component’s CSS file can have a maximum file size of 128 KB (131,072 bytes).

To share CSS style rules among components, create a module that contains only a CSS file and a configuration file. Import the module into the CSS files of Lightning web components.

See Also

The Summer '25 guide is now live

Looking for the Component Reference? Go to https://developer.salesforce.com/docs/component-library/.