0.9.1 • Published 7 years ago

vui-dropdown v0.9.1

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
7 years ago

valence-ui-dropdown

Bower version NPM version Build status Dependency Status

This component contains Sass mixins and CSS that you can use to style dropdown menus.

Installation

Install from NPM:

npm install vui-dropdown

Install from Bower:

bower install vui-dropdown

Usage

This module does not provide any specific styling for the button itself, since this may be accomplished with vui-button depending on your implementation.

Import the mixins:

@import 'bower_components/vui-dropdown/dropdown.scss'; // or...

@import "node_modules/vui-dropdown/dropdown.scss";

Icons:

Use the correct icon based on the type of opener. For example:

  • Primary buttons: $vui-dropdown-icon-primary
  • Secondary buttons: $vui-dropdown-icon-secondary
  • Context menu: Normal: $vui-dropdown-icon-secondary Focus: $vui-dropdown-icon-secondary-focus * Open: $vui-dropdown-icon-secondary-open

Button Menu:

Styling for a button menu with mark-up such as:

<button>
	<span>
		<span>Some Text</span>
	</span>
</button>
button {

	@include vui-dropdown-button-menu; // or...
	@include vui-dropdown-button-menu-primary;

	& > span {
		@include vui-dropdown-button-menu-content;
	}

}

Context Menu:

Styling for a button to be a simple context-menu with with mark-up such as:

<button>
	<span>Some Text</span>
</button>
button {

	@include vui-dropdown-context-menu;

}
button.open {

	@include vui-dropdown-context-menu-open;

}

Important: text should always be provided to make the button accessible. The mixin will create styles to position the text (contained with the span) offscreen.

Menu:

The menu contains the list of items. A simple implementation to position the menu underneath a button would be:

.vui-dropdown-menu {

	@include vui-dropdown-menu;

	display: none;
	left: 0;
	position: absolute;
	top: 2.1rem;
	margin-top: 0.5rem;
	z-index: 1001;

	[dir="rtl"] & {
		left: auto;
		right: 0;
	}

}

.vui-dropdown-menu-visible {
	display: inline-block;
}

Menu Items:

// typical item link
.vui-dropdown-menu-item > a {
	@include vui-dropdown-menu-item-link;
}

// item link that has focus
.vui-dropdown-menu-item.vui-dropdown-menu-item-focus {
	@include vui-dropdown-menu-item-focus;
}

// item link that is disabled
.vui-dropdown-menu-item-disabled > a {
	@include vui-dropdown-menu-item-link-disabled;
}

For further information on this component and other VUI components, see the docs at ui.valence.d2l.com.

Coding styles

See the VUI Best Practices & Style Guide for information on VUI naming conventions, plus information about the EditorConfig rules used in this repo.

0.9.1

7 years ago

0.7.1

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

9 years ago