Giter Site home page Giter Site logo

d3-chosen's Introduction

d3-chosen

image Build Status
Browser Results

A lean collection of lookup and select components. Highlights:


---

lookup-multiple

State

  • options = []: An array of all options. The options can be strings or objects.

  • value = []: The current value of the component: this will be a subset of options.

  • placeholder = '': The placeholder label to display.

  • match: This function should return true or false for every option to determine whether the item should be visible or not. By default, it does case-insensitive fuzzy filtering. For example, "js" would match "JavaScript".

  • focused = false: The current focused state of the component

  • renderer: This function is used to render each individual option. By default, it underlines the parts of the text that match the fuzzy filter.

  • val =str: This function returns the value of an option. If your options are an array of objects, this is used by the default matching function and to determine the label to display for each option. For example:

{ options: [ { firstname: 'John', lastname: 'Smith' } , { firstname: 'Jane', lastname: 'Smith' } , { firstname: 'Jack', lastname: 'Smith' } ] , val: d => d.firstname + ' ' + d.lastname }


* **`suggestion`**: The index of the currently suggested option. This is used internally, you will rarely set this.

* **`query = ''`**: The text currently entered into the textfield

<br>
### Events

* **`change`**: Notifies of all changes to the value (select and deselect).

* **`select`**: Notifies when an option has been selected. `e.detail` is the selected option.

* **`deselect`**: Notifies when an option has been deselected. `e.detail` is the deselecte option.

---
# `lookup-single`

<img src="https://cloud.githubusercontent.com/assets/2184177/18619331/7b52c876-7df1-11e6-80ee-7275b5fa2280.gif" width="300">

### State

* **`options = []`**: An array of all options. The options can be strings or objects. 

* **`value = []`**: The current value of the component: this will be an element in `options`.

* **`placeholder = ''`**: The placeholder label to display.

* **`query = ''`**: The text currently entered into the textfield.

* **`match`**: This function should return `true` or `false` for every option to determine whether the item should be visible or not. By default, it does case-insensitive fuzzy filtering. For example, "js" would match "JavaScript".

* **`focused = false`**: The current focused state of the component

* **`renderer`**: This function is used to render each individual option. By default, it underlines the parts of the text that match the fuzzy filter.

* **`val =`[`str`](https://github.com/utilise/utilise#--str)**: This function returns the value of an option. If your options are an array of objects, this is used by the default matching function and to determine the label to display for each option. For example:

  ```js
{ 
  options: [
    { firstname: 'John', lastname: 'Smith' }
  , { firstname: 'Jane', lastname: 'Smith' }
  , { firstname: 'Jack', lastname: 'Smith' }
  ]
, val: d => d.firstname + ' ' + d.lastname
}
  • suggestion: The index of the currently suggested option. This is used internally, you will rarely set this.

### Events
  • change: Notifies of all changes to the value.

  • blur: Notifies components has lost focus.


select-multiple

// TODO

select-single


// TODO

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.