All Projects → timdeschryver → frontal

timdeschryver / frontal

Licence: MIT License
An Angular select/dropdown component

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to frontal

Multiselect
Vue 3 multiselect component with single select, multiselect and tagging options.
Stars: ✭ 92 (+360%)
Mutual labels:  autocomplete, select, dropdown
react-native-autocomplete-dropdown
Dropdown Item picker with search and autocomplete (typeahead) functionality for react native
Stars: ✭ 87 (+335%)
Mutual labels:  autocomplete, select, dropdown
Ng Select
⭐ Native angular select component
Stars: ✭ 2,781 (+13805%)
Mutual labels:  autocomplete, select, dropdown
vue-single-select
single select dropdown with autocomplete
Stars: ✭ 43 (+115%)
Mutual labels:  autocomplete, select, dropdown
Ember Select Box
🔠 A faux select box for Ember apps
Stars: ✭ 60 (+200%)
Mutual labels:  autocomplete, select, dropdown
Material Ui Superselectfield
multiselection autocomplete dropdown component for Material-UI
Stars: ✭ 260 (+1200%)
Mutual labels:  autocomplete, select, dropdown
choc-autocomplete
🏇 Autocomplete Component Package for Chakra UI
Stars: ✭ 286 (+1330%)
Mutual labels:  autocomplete, select, dropdown
Autocomplete
🔮 Fast and full-featured autocomplete library
Stars: ✭ 1,268 (+6240%)
Mutual labels:  autocomplete, select, dropdown
Downshift
🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.
Stars: ✭ 10,183 (+50815%)
Mutual labels:  autocomplete, select, dropdown
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+11765%)
Mutual labels:  autocomplete, select
Autocomplete
Blazing fast and lightweight autocomplete widget without dependencies. Only 1KB gzipped. Demo:
Stars: ✭ 244 (+1120%)
Mutual labels:  autocomplete, dropdown
tagselector
Dependency-free JS library that turns select fields in customizable tag clouds
Stars: ✭ 19 (-5%)
Mutual labels:  select, dropdown
Vue Cool Select
Select with autocomplete, slots, bootstrap and material design themes.
Stars: ✭ 195 (+875%)
Mutual labels:  autocomplete, select
vue-tags-component
Vue.js 2+ tags component
Stars: ✭ 27 (+35%)
Mutual labels:  select, dropdown
React Selectrix
A beautiful, materialized and flexible React Select control
Stars: ✭ 166 (+730%)
Mutual labels:  autocomplete, dropdown
Smartmaterialspinner
The powerful android spinner library for your application
Stars: ✭ 108 (+440%)
Mutual labels:  autocomplete, dropdown
insect
🛠 Highly customisable, minimalistic input x select field for React.
Stars: ✭ 33 (+65%)
Mutual labels:  select, dropdown
hv-autocomplete
Fast and flexible autocomplete library
Stars: ✭ 16 (-20%)
Mutual labels:  autocomplete, dropdown
react-native-dropdown-autocomplete
Autocomplete input with dropdown modal component for React native. Useful for pages with multiple autocomplete's.
Stars: ✭ 97 (+385%)
Mutual labels:  autocomplete, dropdown
react-multi-select-component
Lightweight (~5KB gzipped) multiple selection dropdown component
Stars: ✭ 279 (+1295%)
Mutual labels:  select, dropdown

Frontal

An Angular select/dropdown accessible component

Build status Styled with prettier npm MIT License Code of Conduct

Installation

Install frontal from npm:

npm install frontal

Usage

Import the FrontalModule:

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    FrontalModule,
  ],
})
export class AppModule {}

Use the frontal component and directives:

<frontal [itemToString]="heroToString">
  <ng-template let-value="inputValue" let-isOpen="isOpen" let-highlightedIndex="highlightedIndex"
   let-selectedItem="selectedItem">
    <label frontalLabel>Select your hero:</label>
    <input type="text" frontalInput/>

    <ul *ngIf="isOpen" frontalList>
      <li *ngFor="let hero of filteredHeroes(value); let index=index;" frontalItem
       [value]="hero" [class.highlight]="highlightedIndex === index">
        {{ hero.name }}
      </li>
    </ul>

    <div *ngIf="isOpen && filteredHeroes(value).length === 0">
      No heroes found...
    </div>

    <h4>Selected hero:</h4>
    <pre>{{ selectedItem | json }}</pre>
  </ng-template>
</frontal>

API

frontal

The frontal component is the container.

Input

itemToString

Used for converting the selected object to a string.

Optional. Default: (value: any) => value

isOpen

The initial isOpen value,

Optional. Default: false

reducer

For each action frontal will dispatch the current state with the dispatched action and the changes that will apply on the state. Based on this it's possible to modify the changes to fit your own needs. These changes will then be applied to frontal's state. The actions can be found at actions.ts

Optional. Default: ({ state: State; action: Action; changes: Partial<State> }) => Partial<State>

Output

change

Event that is fired whenever the inputValue changes. The payload ($event) will be the inputValue.

select

Event that is fired whenever the selectedItem changes. The payload ($event) will be the selectedItem.

State

id

The unique id of a frontal component.

selectedItem

The selected item.

default: null

highlightedIndex

The highlighted index.

default: null

highlightedItem

The highlighted item.

default: null

inputValue

The input value.

default: ''

inputText

The input text as shown in the input.

default: ''

isOpen

Decides if the menu is open or closed. Based on this frontal decides how to handle some actions or the value of some ARIA attributes. For example is the isOpen is false, the input keydown events wont be handled.

default: false

itemCount

The number of frontalItems in the list.

default: 0

frontalInput

frontalInput can be used as a directive to mark the input control. This will set the ARIA attributes as well as the id.

frontalButton

frontalButton can be used as a directive to mark the toggle control. This will set the ARIA attributes as well as the id.

frontalLabel

frontalLabel can be used as a directive to mark the label. This will set the for attribute as well as the id.

frontalList

frontalList can be used as a directive to mark the list. This will set the ARIA attributes as well as the id.

frontalItem

frontalItem can be used as a directive to mark a list item. This will set the ARIA attributes as well as the id.

Input

value

The value of the list item.

Required. Any.

Example

A couple of implementations can be found on StackBlitz.

Inspiration

By taking in all this information, I wondered how this would look like in Angular.

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].