Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@justeattakeaway/pie-button
Advanced tools
pie-button
pie-button
is a Web Component built using the Lit library. It offers a simple and accessible button component for web applications. This component can be easily integrated into various frontend frameworks and customized through a set of properties. For TypeScript projects, it also provides exported enums for type safety and autocompletion.
Install dependencies at the root
yarn
Navigate to this folder, compile with TypeScript and build with Vite
cd packages/components/pie-button
yarn build
Compile and watch for changes (auto-compiles dist
on save)
yarn watch
// default
import { PieButton } from '@justeattakeaway/pie-button';
// react
import { PieButton } from '@justeattakeaway/pie-button/dist/react';
Property | Type | Default | Description |
---|---|---|---|
size | String | BUTTON_SIZE.MEDIUM | Size of the button, one of BUTTON_SIZE enum values (TypeScript Enum) or a raw string value such as 'large' |
type | String | BUTTON_TYPE.SUBMIT | Type of the button, one of BUTTON_TYPE enum values (TypeScript Enum) or a raw string value such as 'submit' |
variant | String | BUTTON_VARIANT.PRIMARY | Variant of the button, one of BUTTON_VARIANT enum values (TypeScript Enum) or a raw string value such as 'primary' |
disabled | Boolean | false | If true , disables the button. |
isFullWidth | Boolean | false | If true , sets the button width to 100% of it's container. |
This component does not use any custom event handlers. In order to add event listening to this component, you can treat it like a native HTML element in your application.
For example, to add a click handler in various templates:
<!-- Other attributes omitted for clarity -->
<pie-button onclick="e => console.log(e)">Click me!</pie-button>
<!-- Other attributes omitted for clarity -->
<pie-button @click="handleClick">Click me!</pie-button>
<!-- Other attributes omitted for clarity -->
<PieButton onClick={handleClick}>increment</PieButton>
For TypeScript projects, we export three enums related to button properties: BUTTON_SIZE
, BUTTON_TYPE
, and BUTTON_VARIANT
. You can import and use these enums to set the corresponding property values for the pie-button
component. This ensures better type safety and autocompletion in your project.
Here's an example of how to import and use the enums in a TypeScript project:
import { BUTTON_SIZE, BUTTON_TYPE, BUTTON_VARIANT } from '@justeattakeaway/pie-button';
// Using the enums to set property values
const myButtonSize = BUTTON_SIZE.LARGE;
const myButtonType = BUTTON_TYPE.RESET;
const myButtonVariant = BUTTON_VARIANT.SECONDARY;
In your markup or JSX, you can then use these variables to set the properties for the pie-button component:
<PieButton size={myButtonSize} type={myButtonType} variant={myButtonVariant}>Click me!</PieButton>
Run at the root of the monorepo:
yarn test:browsers --filter=pie-button
Run at the root of the monorepo:
yarn test:visual --filter=pie-button
FAQs
PIE design system button built using web components
The npm package @justeattakeaway/pie-button receives a total of 276 weekly downloads. As such, @justeattakeaway/pie-button popularity was classified as not popular.
We found that @justeattakeaway/pie-button demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.