Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/vaadin-themable-mixin

Package Overview
Dependencies
Maintainers
12
Versions
479
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/vaadin-themable-mixin

vaadin-themable-mixin

  • 24.3.0-beta1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
92K
decreased by-19.28%
Maintainers
12
Weekly downloads
 
Created

What is @vaadin/vaadin-themable-mixin?

@vaadin/vaadin-themable-mixin is a mixin for creating themable web components. It allows developers to define custom styles and themes for their components, making it easier to maintain a consistent look and feel across applications.

What are @vaadin/vaadin-themable-mixin's main functionalities?

Custom CSS Properties

This feature allows developers to define custom CSS properties that can be used to style components. The code sample demonstrates how to create a custom property for the background color of a component.

import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

class MyComponent extends ThemableMixin(HTMLElement) {
  static get is() { return 'my-component'; }

  static get styles() {
    return [
      css`
        :host {
          --my-component-background-color: white;
          background-color: var(--my-component-background-color);
        }
      `
    ];
  }
}
customElements.define(MyComponent.is, MyComponent);

Theme Variations

This feature allows components to support different theme variations. The code sample shows how to apply different styles when a 'dark' theme is applied to the component.

import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';

class MyComponent extends ThemableMixin(HTMLElement) {
  static get is() { return 'my-component'; }

  static get styles() {
    return [
      css`
        :host([theme~="dark"]) {
          background-color: black;
          color: white;
        }
      `
    ];
  }
}
customElements.define(MyComponent.is, MyComponent);

Other packages similar to @vaadin/vaadin-themable-mixin

Keywords

FAQs

Package last updated on 24 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc