![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@asphalt-react/content-switcher
Advanced tools
Component to switch between alternate views of a content within the same page or screen. Only one view is visible at a time. For instance, use ContentSwticher to switch between tabular view and graphical view of a dataset. It's a controlled component where you control which content view should be visible.
ContentSwitcher exports another component named Switch. Switch creates the tabs for each view. Switches come in 2 sizes: small and medium (default). Each Switch has three types of caption:
Switch accepts most of the button element's attributes such as id
& name
and supports data-* attributes.
role="tablist"
and the Switches have role="tab"
.true
.role="tabpanel"
to the content section.id
to a Switch. Pass the "id"'s value to aria-labelledby
attribute to the element of the content section.id
to the view section element. Pass the "id"'s value to aria-controls
attribute of its Switch.aria-label
or aria-labelledby
in Switch with icon as caption.Check examples to see these in action.
import React, { useState } from "react"
import { ContentSwitcher, Switch } from "@asphalt-react/content-switcher"
function App() {
const [active, setActive] = useState(0)
const clickHandler = (value) => setActive(value)
return (
<main>
<ContentSwitcher>
<Switch value={0} onAction={clickHandler} active={active === 0}>
First
</Switch>
<Switch value={1} onAction={clickHandler} active={active === 1}>
Second
</Switch>
</ContentSwitcher>
<div>
{active === 0 && (<div>First Section</div)}
{active === 1 && (<div>Second Section</div>)}
</div>
</main>
)
}
export default App
Switch components.
type | required | default |
---|---|---|
node | true | N/A |
Switch caption.
type | required | default |
---|---|---|
node | true | N/A |
Index of the Switch.
type | required | default |
---|---|---|
number | true | N/A |
Adds styles to show the Switch is active.
type | required | default |
---|---|---|
bool | false | N/A |
Callback to handle Switch selection.
The function accepts 2 arguments:
value
prop of the Switch.onAction(value, { event }) {
console.log(value)
}
type | required | default |
---|---|---|
func | false | N/A |
Size of the Switches. Accepts one of "s" or "m" for small & medium.
type | required | default |
---|---|---|
enum | false | "m" |
Renders icon as caption.
type | required | default |
---|---|---|
bool | false | false |
Icons to add more context to the textual caption.
Accepts SVG or SVG wrapped React component. Checkout @asphalt-react/iconpack
for SVG wrapped React components.
⚠️ Do not use
qualifier
to render a Switch with icon as caption; useicon
prop instead.
type | required | default |
---|---|---|
element | false | N/A |
Appends qualifier to the text in caption. Switch prepends the qualifier by default.
type | required | default |
---|---|---|
bool | false | false |
FAQs
Content switcher
The npm package @asphalt-react/content-switcher receives a total of 0 weekly downloads. As such, @asphalt-react/content-switcher popularity was classified as not popular.
We found that @asphalt-react/content-switcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.