Please note that this project is now deprecated, and will no longer be directly supported.
Documentation | Code of Conduct | Contributing | License | Support | Lyft.com/developers
- Sign up for a
client_idandclient_tokenat lyft.com/developers. - Grab the component itself from dist.
- Copy an example html file from dist and fill in the blanks.
See the example file for a sample configuration object:
var OPTIONS = {
scriptSrc: 'lyftWebButton.js', // path to script location on your server
namespace: '', // optional namespace
clientId: '',
clientToken: '',
location: {
pickup: { // optional; leave as an empty object to use current location if document.navigator is available
latitude: '37.7604',
longitude: '-122.4132',
},
destination: {
latitude: '37.7604',
longitude: '-122.4132',
},
},
parentElement: document.getElementById('lyft-web-button-parent'), // where to place the button on your page
queryParams: {
credits: '' // optional credits param is the only accepted redirect parameter presently
},
theme: 'multicolor large', // see below for theme options
};Several themes are available; see dist/development.multiple.html for all possible examples, or look in src/components/lyftWebButton/index.css for the CSS.
If you chose lyftWebButton and configured it correctly it should look like this:
If you want to build your own components or modify existing ones you'll need to continue reading.
To build this from source make sure you have the following:
Next, open a shell session and enter the following commands:
# clone repository
git clone https://github.com/lyft/lyft-web-button.git
# install dependencies
cd lyft-web-button
npm install- Start the server with
npm start(ornpm run-script start). - Open webpack-dev-server in a web browser.
- As you work the page will automatically update via websocket connection.
Alternatively, you can run npm watch:dev to build assets without using webpack-dev-server.
# build
npm run-script build
# build with minification
npm run-script build:dist
# regenerate documentation
npm run-script doc
# lint
npm run-script lintlyftWebButtoncan appear more than once on a page, but the implementation needs improvement.lyftWebModaluses a single theme, but it can be overridden with CSS.lyftWebModalonly supports Google Maps at this time, but it may be worth allowing a custom background image.
If you're looking for help configuring or using the Lyft Web Button, or if you have general
questions related to our APIs, the Lyft Developer Platform team provides support through
our forum as well as on Stack Overflow using the
lyft-api tag. Please do not create tickets on help.lyft.com as this is our help desk
for regular users, and we won't be able to respond to requests made there.
If you've found a vulnerability or a potential vulnerability in the Lyft Web Button please let us know at security@lyft.com. We'll send a confirmation email to acknowledge your report, and we'll send an additional email when we've identified the issue positively or negatively.
