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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ruc-lib/drawer

v3.1.0

Published

A highly configurable drawer component that provides a slide-in panel from any of the four directions (left, right, top, or bottom). It's designed for displaying supplementary content, navigation, or forms without navigating away from the current view.

Readme

ruclib-drawer

A highly configurable drawer component that provides a slide-in panel from any of the four directions (left, right, top, or bottom). It's designed for displaying supplementary content, navigation, or forms without navigating away from the current view.

Features

  • Flexible Positioning: Open the drawer from the 'left', 'right', 'top', or 'bottom' of the container.
  • Custom Sizing: Define custom width for vertical drawers and height for horizontal drawers.
  • Smooth Animations: Configurable slide-in/out animation duration.
  • Display Modes: Supports an 'over' mode where the drawer slides over the main content.
  • Content Customization: Set a custom title and use rich HTML for the drawer's body and the main content area.
  • Interactive Toggle:
    • Optionally display a toggle button in the main content area.
    • Customize button text for 'open' and 'close' states.
    • Use Material icons or custom image URLs for the button.
  • Backdrop Control: Enable or disable a backdrop, and customize its background color.
  • Close Mechanisms:
    • Show or hide a close icon within the drawer.
    • Prevent closing via the Escape key or backdrop click.
  • Theming: Apply custom theme classes for tailored styling.

Installation Guide

Install the Entire Library

npm install @uxpractice/ruc-lib

Install Individual Component

If you only need the Drawer component:

npm install @ruc-lib/drawer

📦 Version Compatibility

Please ensure you install the correct version of @ruc-lib/drawer based on your Angular version.

| Angular Version | Compatible @ruc-lib/drawer Version | |--------------------|------------------------------------------| | 15.x.x | npm install @ruc-lib/drawer@^3.0.0 | | 16.x.x | npm install @ruc-lib/drawer@^3.0.0 |

Usage

1. Import the Component

In your Angular component file (e.g., app.component.ts), import the RuclibDrawerComponent:

import { Component } from '@angular/core';

// For Complete Library
import { RuclibDrawerComponent } from '@uxpractice/ruc-lib/drawer';

// For Individual Package
import { RuclibDrawerComponent } from '@ruc-lib/drawer';

@Component({
  selector: 'app-root',
  imports: [RuclibDrawerComponent],
  templateUrl: './app.component.html',
})
export class AppComponent {
  // Component code here
}

2. Use the Component

In your component's template, use the <uxp-ruclib-drawer> selector:

<uxp-ruclib-drawer
    [rucInputData]="drawerInput"
    [customTheme]="customTheme"
    (rucEvent)="passEvent($event)">
</uxp-ruclib-drawer>

API Reference

Component Inputs

| Input | Type | Description | |----------------|-----------------------|--------------------------------------------------| | rucInputData | RuclibDrawerInput | The main configuration object for the drawer. | | customTheme | string | An optional CSS class for custom theming. |

Component Outputs

| Output | Type | Description | |------------|-------|----------------------------------------------| | rucEvent | any | Emits events from the drawer. |

rucInputData (RuclibDrawerInput)

This is the main configuration object for the Drawer component.

| Property | Type | Description | |------------------------------------|----------------------|---------------------------------------------------------------------------------------------------------| | drawerPosition | string | Position of the drawer. Can be 'left', 'right', 'top', or 'bottom'. Default is 'left'. | | mode | string | Drawer mode. Can be 'over', 'push', or 'side'. Default is 'over'. | | initialOpenedState | boolean | If true, the drawer is open initially. Default is false. | | drawerWidth | string | Width of the drawer when drawerPosition is 'left' or 'right'. Default is '250px'. | | drawerHeight | string | Height of the drawer when drawerPosition is 'top' or 'bottom'. | | content | object | An object containing the HTML content for the drawer and main area. See Content table below. | | disableToggleButtonInMainContent | boolean | If true, the toggle button in the main content area is hidden. Default is false. | | toggleButtonText | object | An object for the toggle button's text. See ToggleButtonText table below. | | hasBackdrop | boolean | If true, a backdrop is shown when the drawer is open. Default is true. | | backdropBackgroundColor | string | The CSS background color for the backdrop. Default is 'rgba(129, 124, 124, 0.6)'. | | showCloseIcon | boolean | If true, a close icon is displayed inside the drawer. Default is true. | | disableClose | boolean | If true, the drawer cannot be closed by pressing Escape or clicking the backdrop. Default is false. | | animationDuration | string | The duration of the open/close animation. Default is '300ms'. | | toggleButtonIcon | string | The name of the Material Icon for the toggle button. | | toggleButtonImageUrl | string | The URL for a custom image on the toggle button. | | toggleButtonDimensions | ButtonDimensions | An object to control the dimensions of the toggle button. See ButtonDimensions table below. | | closeButtonDimensions | IconDimensions | An object to control the dimensions of the close icon. See IconDimensions table below. |

content

| Property | Type | Description | |---------------|----------|-------------------------------------------| | drawerTitle | string | The title displayed in the drawer's header. | | drawerBody | string | The HTML content for the drawer's body. | | mainBody | string | The HTML content for the main area. |

toggleButtonText

| Property | Type | Description | |----------|----------|---------------------------------------------| | open | string | Text for the toggle button to open the drawer. | | close | string | Text for the toggle button to close the drawer. |

toggleButtonDimensions (ButtonDimensions)

| Property | Type | Description | |------------|----------|-------------------------------------------| | width | string | The width of the toggle button. | | height | string | The height of the toggle button. | | padding | string | The padding of the toggle button. | | fontSize | string | The font size of the toggle button text. | | iconSize | string | The size of the icon on the toggle button. |

closeButtonDimensions (IconDimensions)

| Property | Type | Description | |------------|----------|----------------------------------| | width | string | The width of the close button. | | height | string | The height of the close button. | | iconSize | string | The size of the close icon. |

Example Configuration

Here's an example of how to configure the Drawer component in your component's TypeScript file.

import { Component } from '@angular/core';

// For Complete Library
import { RuclibDrawerModule, RuclibDrawerInput, ButtonDimensions, IconDimensions } from '@uxpractice/ruc-lib/drawer';

// For Individual package
import { RuclibDrawerModule, RuclibDrawerInput, ButtonDimensions, IconDimensions } from '@ruc-lib/drawer';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
})
export class AppComponent {
  customTheme = 'ruc-custom-theme';

  drawerInput: RuclibDrawerInput = {
    drawerPosition: 'left',
    mode: 'over',
    initialOpenedState: false,
    drawerWidth: '300px',
    drawerHeight: '',
    content: {
        drawerTitle: 'Navigation Menu',
        drawerBody: '<p>This is where your navigation links or filters would go.</p>',
        mainBody: '<h2>Main Application Content</h2><p>Click the button to open the drawer.</p>',
    },
    disableToggleButtonInMainContent: false,
    toggleButtonText: {
        open: 'Open Menu',
        close: 'Close Menu',
    },
    hasBackdrop: true,
    backdropBackgroundColor: 'rgba(0, 0, 0, 0.5)',
    showCloseIcon: true,
    disableClose: false,
    animationDuration: '400ms',
    toggleButtonIcon: 'menu',
    toggleButtonImageUrl: '',
    toggleButtonDimensions: {
        width: 'auto',
        height: '48px',
        padding: '0 16px',
        fontSize: '14px',
        iconSize: '24px',
    },
    closeButtonDimensions: {
        width: '48px',
        height: '48px',
        iconSize: '24px',
    },
  };

  passEvent(event: any) {
    console.log('Drawer Event:', event);
  }
}

⚠️ IMPORTANT: Custom Theme Usage in Angular Material

When implementing custom themes, such as:

.custom-theme-1 {
  @include angular-material-theme($custom-theme);
}

// You must also include the typography mixin to ensure text styles are applied correctly as shown below:
.custom-theme-1 {
  @include angular-material-theme($custom-theme);
  @include mat.typography-level($theme-custom-typography-name, body-1);
}

Contribution

Contributions are welcome! Feel free to open issues or pull requests for any enhancements or fixes.

Acknowledgements

Thank you for choosing the Drawer Component Library. If you have any feedback or suggestions, please let us know!