Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@qodunpob/component-demo-ui
Advanced tools
A tiny UI library for creating a single page application to demonstrate a component
If you are seeking for a simple solution to demonstrate a single React-component working, this might be what you need.
The tiny UI library provides several of components for creating a single page application with a preview of your component, a description of its props, additional sections and a link to GitHub. An example of what a demo page might look like can be found in the demo folder, use the following command to run:
npm start
npm install --save @qodunpob/component-demo-ui
First of all you need to import global styles for the magic to work
import '@qodunpob/component-demo-ui/dist/assets/styles/styles.css'
This will import the Lato font from Google Fonts, add global styles for component containers, and also initialize color variables that you can change if desired
:root {
--component-demo-ui-border-color: #ccc;
--component-demo-ui-input-border-color: #00aaff;
--component-demo-ui-input-focus-border-color: #ff00aa;
}
The following is a list of components that this library provides.
You'll probably want to put this component at the top of the page. It displays the h1 level header and your component in action, so it requires specifying the title and passing the child element.
Name | Necessity | Type | Description |
---|---|---|---|
title | required | string | H1 page title, probably the name of the component |
children | required | ReactElement | Component itself |
className | optional | string | Custom css class |
caption | optional | string | Text block between title and component |
description | optional | string | Text block at the end of Preview component (after Inspector) |
controls | optional | ControlDefinition[] | Setting up controls that allow a visitor to change the value of a component's properties. There are 3 types of controls available: - text - checkbox - select |
showInspector | optional | boolean | Inspector display indicator |
inspectorTitle | optional | string | Inspector window title (if it's displayed) |
The Preview component provides an interface for interaction (PreviewRef):
export interface PreviewRef {
inspect: (data: any) => void
}
You can pass any data to the inspect method to display it in the Inspect component.
Simply displays a link to your component's GitHub repository in a corner style on the page. An important feature is that the GitHub icon used is background independent, and even if it is initially oriented towards a light page background, you can always recolor it.
Name | Necessity | Type | Description |
---|---|---|---|
url | required | string | Link to your component's GitHub repository |
className | optional | string | Custom css class |
Component for declaring a section on pages with an h2-level heading and any content.
Name | Necessity | Type | Description |
---|---|---|---|
title | required | string | H2 section title |
children | optional | ReactNode | Section content |
className | optional | string | Custom css class |
Represents props as a list of terms and their descriptions.
Name | Necessity | Type | Description |
---|---|---|---|
items | required | PropDefinition[] | List of described props |
className | optional | string | Custom css class |
Caution: The PropList component itself is not a section and does not have page container styles, so it should be placed inside a section as a child element.
You can see the direct use of all the components described above in the demo.
Feel free to add proposals or report bugs in issues. Your PRs are welcome!
To run the demo, as noted above, use the command:
npm start
To build the library locally, use the command:
npm run lib:build
Don't forget to check your changes with tests and linters:
npm test
npm run lint
npm run lint:fix
npm run format
The project uses standard-with-typescript configuration for eslint, with added React-specific rules.
MIT.
FAQs
A tiny UI library for creating a single page application to demonstrate a component
We found that @qodunpob/component-demo-ui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.