Socket
Book a DemoInstallSign in
Socket

@vaadin/vaadin-themable-mixin

Package Overview
Dependencies
Maintainers
19
Versions
569
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

22.0.0-alpha3
Source
npmnpm
Version published
Weekly downloads
130K
-16.92%
Maintainers
19
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

Vaadin

FAQs

Package last updated on 27 Aug 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.