KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
react-trafficlight
★ 9
Open GitHub ↗
Traffic light component for React
Download README (.md)
Explore Similar Repositories
SystemLocaleDsc
:
DSC Resource for configuring Windows System Locale
ircgram
:
IRCGram is a complexly simple Telegram <-> IRC Gateway
autominer-api
:
Automatically rent miners based on the current cost to mine the currency.
filebox
:
Filebox could be used to provide access permission control for files, directories
RealFakeGarageDoors
:
Garage Door Opener for ESP8266 / Arduino
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
react-trafficlight
?
Download (.md)
# react-trafficlight Traffic light component for React.  ## Installation ``` npm install --save react-trafficlight ``` ## Demo Working demo on CodePen: [React Traffic Light](https://codepen.io/sgnh/full/jmRXwd/) ## Example use  ## Usage example 1 ```javascript import React from 'react'; import TrafficLight from 'react-trafficlight'; const TrafficLightContainerExample1 = () => ( <div> <TrafficLight RedOn /> <TrafficLight RedOn YellowOn /> <TrafficLight YellowOn /> <TrafficLight GreenOn /> </div> ); export default TrafficLightContainerExample1; ``` ## Usage example 2 - Clickable ```javascript import React, { Component } from 'react'; import TrafficLight from 'react-trafficlight'; class TrafficLightContainerExample2 extends Component { state = { redOn: true, yellowOn: false, greenOn: false, } render() { return ( <TrafficLight onRedClick={() => this.setState({ redOn: !this.state.redOn })} onYellowClick={() => this.setState({ yellowOn: !this.state.yellowOn })} onGreenClick={() => this.setState({ greenOn: !this.state.greenOn })} RedOn={this.state.redOn} YellowOn={this.state.yellowOn} GreenOn={this.state.greenOn} /> ); } } export default TrafficLightContainerExample2; ``` ## Usage example 3 - Horizontal ```javascript import React from 'react'; import TrafficLight from 'react-trafficlight'; const TrafficLightContainerExample3 = () => ( <div> <TrafficLight GreenOn Horizontal/> </div> ); export default TrafficLightContainerExample3; ```