
Research
/Security News
Intercom’s npm Package Compromised in Ongoing Mini Shai-Hulud Worm Attack
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.
@asphalt-react/flag
Advanced tools
Flag component is used to provide any information from the application to the user. They should be used for successful, cautious, destructive kind of messages. Flags can be inlined, floated, embedded or shown as a banner.
import {
InlineFlag,
FloatingFlag,
BannerFlag,
PageFlag
} from "@asphalt-react/flag"
<InlineFlag success>
Email format is incorrect
</InlineFlag>
<FloatingFlag title="Remove user?" danger>
This action is irreversible
</FloatingFlag>
<BannerFlag title="Policy changes" warning>
Tax rules are changing in the next month
</BannerFlag>
<PageFlag title="We don't spam" neutral>
We will only send you useful emails
</PageFlag>
There are four variants of Flags, each available as named exports:
InlineFlag: Used to show information related to form fields, for example, a validation error.
FloatingFlag: Used for showing alerts or toasts. Floating flags are responsive to viewport sizes. Floating flags have support intent background color by default.
BannerFlag: Used to show information that demands more user attention. It adjusts to the container's width always.
PageFlag: Used to show contextual background information for filling a form. Embeds the Flag into the page and adjusts to the container's width.
All Flags support multiple support intents:
If a Flag receives multiple intents, it fallbacks to the "info" intent. For example:
<PageFlag warning danger title="Required fields">
All fields are mandatory
</PageFlag>
This will render a Page flag with "info" intent.
Create toast notifications with the FloatingFlag component and the useToast hook. Toasts display temporary, dismissible messages to users.
import React from "react"
import { Button } from "@asphalt-react/button"
import { FloatingFlag, useToast } from "@asphalt-react/flag"
function ToastDemo() {
const { visible, show, hide } = useToast()
return (
<>
<style>{`
.toastPanel {
position: fixed;
z-index: 1;
right: 0;
top: 0;
padding: 1rem;
margin-bottom: 1rem;
visibility: hidden;
opacity: 0;
transform: translateX(340px);
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out, transform 0.5s ease-in-out;
}
.toastPanel.visible {
visibility: visible;
opacity: 1;
transform: translateX(0);
}
`}</style>
<Button onClick={show}>Show Toast</Button>
<div className={`toastPanel${visible ? ' visible' : ''}`}>
<FloatingFlag success title="Success" onDismiss={hide}>
That was a successful demo
</FloatingFlag>
</div>
</>
)
}
This example shows how to trigger a toast message with a button. The toast will appear and can be dismissed by the user.
Flags is composed of predefined areas to serve a particular purpose. They adapt to different variants and intents.
InlineFlag only has icon and text in them and they are not dismissible.
Icon & Title can be center aligned when there is no description and action area. Actions render in the start of the flag. They can be moved to the end as well.
React node for the main content.
| type | required | default |
|---|---|---|
| node | false | null |
To override the default qualifier icon. Pass false to hide it.
Accepts SVG.
| type | required | default |
|---|---|---|
| union | false | null |
Size of the flag, controls the icon and text size.
| type | required | default |
|---|---|---|
| enum | false | "m" |
Enables the info intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the success intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the danger intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the warning intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the neutral intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the invalid intent.
| type | required | default |
|---|---|---|
| bool | false | false |
React node for the description content.
| type | required | default |
|---|---|---|
| node | false | null |
React node for the title content.
| type | required | default |
|---|---|---|
| node | false | null |
To override the default qualifier icon. Pass false to hide it.
Accepts SVG.
| type | required | default |
|---|---|---|
| union | false | null |
List of actionable elements.
| type | required | default |
|---|---|---|
| node | false | null |
Enables the info intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the success intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the danger intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the warning intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the neutral intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the inverse intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Adds a support intent background color to make the flag prominent.
| type | required | default |
|---|---|---|
| bool | false | true |
Callback for dismiss action.
| type | required | default |
|---|---|---|
| func | false | N/A |
Enables the dismiss action.
| type | required | default |
|---|---|---|
| bool | false | true |
React node for the description content.
| type | required | default |
|---|---|---|
| node | false | null |
React node for the title content.
| type | required | default |
|---|---|---|
| node | false | null |
Centers the title horizontally.
| type | required | default |
|---|---|---|
| bool | false | false |
To override the default qualifier icon. Pass false to hide it.
Accepts SVG.
| type | required | default |
|---|---|---|
| union | false | null |
List of actionable elements.
| type | required | default |
|---|---|---|
| element | false | null |
Positions the actionable element towards the end of the container
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the info intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the success intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the danger intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the warning intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the neutral intent.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the dismiss action.
| type | required | default |
|---|---|---|
| bool | false | true |
Callback for the dismiss action.
| type | required | default |
|---|---|---|
| func | false | N/A |
React node for the description content.
| type | required | default |
|---|---|---|
| node | false | null |
React node for the title content.
| type | required | default |
|---|---|---|
| node | false | null |
Centers the title horizontally.
| type | required | default |
|---|---|---|
| bool | false | false |
To override the default qualifier icon. Pass false to hide it.
Accepts SVG.
| type | required | default |
|---|---|---|
| union | false | null |
List of actionable elements.
| type | required | default |
|---|---|---|
| element | false | null |
Positions the actionable element towards the end of the container
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the info intents.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the success intents.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the danger intents.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the warning intents.
| type | required | default |
|---|---|---|
| bool | false | false |
Enables the neutral intents.
| type | required | default |
|---|---|---|
| bool | false | false |
Renders a dismiss button.
| type | required | default |
|---|---|---|
| bool | false | true |
Callback for dismiss action.
| type | required | default |
|---|---|---|
| func | false | null |
Adds a border-radius to the flag.
| type | required | default |
|---|---|---|
| bool | false | true |
FAQs
Flag
The npm package @asphalt-react/flag receives a total of 62 weekly downloads. As such, @asphalt-react/flag popularity was classified as not popular.
We found that @asphalt-react/flag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

Research
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.