import React from 'react';
import ReactDOM from 'react-dom';
import { MultiSelect } from 'web-foundation';

class MultiSelectCtrl extends React.Component {
    state = {
        selected: [ 0 ]
    };

    onSelection(selected) {
        this.setState({ selected });
    }

    render() {
        return (
            <MultiSelect
                selected={ this.state.selected }
                onSelection={ this.onSelection.bind(this) }
                options={ [
                    {
                        title: 'Option 1',
                        value: 0
                    }, {
                        title: 'Option 2',
                        value: 1
                    }, {
                        title: 'Option 3',
                        value: 2
                    }
                ] } />
        );
    }
}

export default function() {
    ReactDOM
        .render(<MultiSelectCtrl />, document.getElementById('multi-select'));
}
