npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@material-spirit/ngx-split-button

v1.0.1

Published

[![Rate this package](https://badges.openbase.com/js/rating/@material-spirit/ngx-split-button.svg?token=2IPDsNbnBzAz4pxdHpuJtw2mTk9td3b9EUUiRxBpVqk=)](https://openbase.com/js/@material-spirit/ngx-split-button?utm_source=embedded&utm_medium=badge&u

Downloads

5

Readme

Angular Material Split Button

Rate this package

DEMO    →     https://split-button.material-spirit.dev


A split button is a type of button that allows users to select a default action and access additional options with a dropdown menu.

Angular Material Split Button

The idea behind the MasSplitButton design is to create a split button component that is unified with Angular Material in terms of approach, API and styling/theming.

  • It uses Angular Material Menu in order to implement the dropdown menu feature.
  • Its Sass API consumes standard Angular Material theme config in order to ensure a consistent user experience.
  • It reuses a lot of Angular Material Button's code to ensure maximum compatibility with future versions.

Getting Started

yarn add @material-spirit/ngx-split-button

Import MasSplitButtonModule module in your app's module.

app.module.ts

import { MasSplitButtonModule } from "@material-spirit/ngx-split-button";
...

@NgModule({
    ...
    imports: [ MasSplitButtonModule ],
    ...
});

You can choose from pre-built CSS theme files, or apply your custom Angular Material theme using Sass API.

Option 1. Using pre-built CSS files

The package includes four pre-built CSS files, which match standard Angular Material pre-built themes:

  • @material-spirit/ngx-split-button/prebuilt/deeppurple-amber.css
  • @material-spirit/ngx-split-button/prebuilt/indigo-pink.css
  • @material-spirit/ngx-split-button/prebuilt/pink-bluegrey.css
  • @material-spirit/ngx-split-button/prebuilt/purple-green.css

Similar to including Angular Material pre-built theme, to include Split Button's pre-built theme in your application, add your chosen CSS file to the styles array of your project's angular.json file.

angular.json

...
    "styles": [
      "@material-spirit/ngx-split-button/prebuilt/pink-bluegrey.css"
    ],
...

Option 2. Using custom Angular Material theme via Sass API

@use '@angular/material' as mat;
@use '@material-spirit/ngx-split-button' as mas-split-button;

// Emit core Split Button styles.
@include mas-split-button.core-styles;


// If you have not already done so, define your custom Angular Material theme.
$my-primary: mat.define-palette(mat.$indigo-palette, 500);
$my-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);

$my-theme: mat.define-light-theme((
 color: (
   primary: $my-primary,
   accent: $my-accent,
 ),
 density: 0,
));


// Emit styles that depend on the theme config.
@include mas-split-button.theme($my-theme);

Use

<mas-split-button
  type="elevated"
  color="primary"
  [matMenu]="buttonMenu">
  Split Button
</mas-split-button>

<mat-menu #buttonMenu="matMenu">
  <button mat-menu-item>Action 2</button>
  <button mat-menu-item>Action 3</button>
</mat-menu>

See documentation for MatSplitButton for more information.