
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
ic-snacks
Advanced tools
JavaScript Component Library by Instacart
Please note: We're still in pre-release stage. If you opt to use Snacks, please be prepared for breaking changes in the future.
You can use either yarn
or npm
to install Snacks and its dependencies.
yarn add 'ic-snacks'
npm install 'ic-snacks'
Snacks has a few peer dependencies required to use the library.
If you already have these libraries listed in your app's dependencies, there's no need to install them again.
For the main component library:
If you'd like to use animations: react-transition-group v2.2
Sometimes it may be helpful to work on this project locally and view the changes in another app. This can be accomplished using npm link
# From this directory
npm link
# go to the app you are working on
cd ../workspace/my_working_app
# symlink this app
npm link ic-snacks
To reverse the process, you can do the following
# go to the app you are working on
cd ../workspace/my_working_app
# remove symlink
npm unlink ic-snacks
yarn add @instacart/radium
yarn add prop-types
yarn add react
yarn add react-dom
yarn add react-transition-group
npm install @instacart/radium
npm install prop-types
npm install react
npm install react-dom
npm install react-transition-group
Using a component:
import { CircleButton } from 'ic-snacks'
const MyComponent = props => {
const doYes = e => { alert('Snacks are the best!') }
const doNo = e => { alert('Wrong choice, choose again.') }
return (
<div>
<p>Do you love snacks?</p>
<CircleButton onClick={doYes}>Yes</CircleButton>
<CircleButton onClick={doNo}>No</CircleButton>
</div>
)
}
A more complicated component:
import React, { Component } from 'react'
import { NavigationPills } from 'ic-snacks'
const choices = [
{ text: 'bananas' },
{ text: 'carrots' },
{ text: 'watermelon' },
{ text: 'snacks' },
{ text: 'kale' },
{ text: 'endives' },
{ text: 'arugula' },
{ text: 'spinach' },
{ text: 'potatoes' }
]
class Navigation extends Component {
static state = {
activePill: choices[0]
}
render() {
return (
<div>
<NavigationPills
pills={ choices }
onPillClick={(e, choice) => {
e.preventDefault();
setState({ activePill: choice.text })
console.log('Choice clicked!', choice)
}}
label='Favorite healthy snack:'
activePill={state.activePill}
/>
</div>
)
}
}
https://instacart.github.io/Snacks/
Please see contributing docs
FAQs
The Instacart Component Library for Web
The npm package ic-snacks receives a total of 5,911 weekly downloads. As such, ic-snacks popularity was classified as popular.
We found that ic-snacks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.