LocationTextInput
LocationTextInput extends TextInput and adds an icon to get the user's current location
Example Usage
<div class='ui-location-text-input-example'></div>
// Pull in the library
const UI = require('jibe-juice');
// Instantiate a component, pass the selector of the container to insert component into and the opts
const myInput = new UI.LocationTextInput('.ui-location-text-input-example', {
placeholder: 'What up?',
submitHandler() {
console.log('the enter key has been pressed!');
}
});
myInput.subscribe((value) => {
console.log("the current value is: ", value);
});
// Render the DOM for the LocationTextInput component
myInput.render();
params
Name | Type | Default | Description |
---|---|---|---|
el | string | undefined | A string of the selector for the element to put the component in |
opts | object | {} | A catch all for various options. See the opts table below for options specific to this component. |
opts
Name | Type | Default | Description |
---|---|---|---|
currentLocationText | string | undefined | The text to display for "use my current location" |
placeholder | string | '' | The placeholder text for the input |
submitHandler | function | () => {} | The function to execute when enter is pressed |
Updated less than a minute ago