ArtPlasmaBall
ArtPlasmaBall renders the ArtPlasmaBall CSS-art scene as a reusable React component.
@duskmoon-dev/art-componentsUsage
When to use
- Use it when a page needs a reusable DuskMoon visual asset rendered from CSS rather than an image.
- Keep it decorative unless the illustration carries information that must be announced.
Implementation notes
Features
Renders the matching @duskmoon-dev/css-art scene through a typed React component.
Defaults to decorative output while allowing aria labels and roles when the scene carries meaning.
ArtPlasmaBall is most often configured through `checked`, `defaultChecked`, `hideBase`, `hideElectrode`.
Renders interactive plasma rays and switch state
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import ArtPlasmaBall and the art component stylesheet before rendering the CSS art scene.
Source
import "@duskmoon-dev/art-components/styles.css";
import { ArtPlasmaBall } from "@duskmoon-dev/art-components";
export function Example() {
return (<ArtPlasmaBall size="sm" defaultChecked />);
}Accessible art
Use ArtPlasmaBall as decorative output by default, or pass accessible labeling when the scene is meaningful.
Source
import "@duskmoon-dev/art-components/styles.css";
import { ArtPlasmaBall } from "@duskmoon-dev/art-components";
export function AccessibleArt() {
return (<ArtPlasmaBall size="sm" defaultChecked
decorative={false}
aria-label="Art Plasma Ball illustration" />);
}Plasma power: Off
The disabled checkbox cannot change its power state.
Native toggle and disabled state
Activate the ball by click or Space to change its visible power state. The second native checkbox is disabled.
Source
import { useState } from "react";
import { ArtPlasmaBall } from "@duskmoon-dev/art-components";
import "@duskmoon-dev/art-components/styles.css";
export function PlasmaPower() {
const [checked, setChecked] = useState(false);
return (
<>
<ArtPlasmaBall size="sm" hideBase checked={checked}
onCheckedChange={setChecked}
inputProps={{ "aria-label": "Power plasma ball" }} />
<p role="status">Plasma power: {checked ? "On" : "Off"}</p>
<ArtPlasmaBall size="sm" hideBase checked={false}
inputProps={{ "aria-label": "Disabled plasma power", disabled: true }} />
</>
);
}API
The API reference below lists every parsed exported type or interface for ArtPlasmaBall. Start with `checked`, `defaultChecked`, `hideBase`, `hideElectrode` for common usage.
packages/art-components/src/index.tsxScenarios: packages/art-components/tests/art-components.test.tsx| Prop | Type | Required | Description |
|---|---|---|---|
checked | boolean | No | checked configures ArtPlasmaBall. |
defaultChecked | boolean | No | defaultChecked configures ArtPlasmaBall. |
hideBase | boolean | No | hideBase configures ArtPlasmaBall. |
hideElectrode | boolean | No | hideElectrode configures ArtPlasmaBall. |
inputProps | Omit< | No | inputProps configures ArtPlasmaBall. |
onCheckedChange | (checked: boolean) => void | No | onCheckedChange configures ArtPlasmaBall. |