1.0.0 • Published 9 months ago

@ryze-digital/simple-dropdown v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

RYZE Digital Simple Dropdown

Run linter(s) workflow status

Install

npm i @ryze-digital/simple-dropdown --save

Usage

HTML

You can change the HTML to your needs if necessary, as long as you include the mixins (see Scss) correctly.

<div class="simple-dropdown" tabindex="0">
    <button type="button">
        <span>Your button label</span>
    </button>
    <div class="panel">
        Your dropdown content
    </div>
</div>

Scss

@use "@ryze-digital/simple-dropdown";

Use the provided configure mixin to define your dropdown defaults.

@include simple-dropdown.configure(...);
OptionTypeDefaultDescription
iconMapConfigure which icons from your icon font should be used
icon.indicatorString (Quoted)nullThe UTF-8 character of the icon to help understand the button label
icon.closedString (Quoted)nullThe UTF-8 character of the icon to use when the dropdown panel is hidden
icon.openedString (Quoted)nullThe UTF-8 character of the icon to use when the dropdown panel is visible
icon.spacingNumbernullThe gap between icons and button label
directionString (Quoted)"down"Should the panel drop "up" or "down"

Check out the actual configure mixin for better understanding.

There is a separate mixin for each element of simple dropdown so styles can be applied to any markup.

.simple-dropdown {
    @include simple-dropdown.container();
    .panel {
        @include simple-dropdown.panel();
    }
    button {
        @include simple-dropdown.button();
    }
}

Demos

Checkout this repository and use the /demos folder as document root to see a running demo in the browser.

1.0.0

9 months ago

1.0.0-beta.0

2 years ago