@quartzds/core-react
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta.1 • Public • Published

@quartzds/core-react

NPM Package License

React wrapper for Quartz design system web components.

💿 Installation

npm install @quartzds/core-react react react-dom

📖 Usage

Importing Components

Every Quartz core component is available to import as a React component. Note that we're importing the <QdsButton> React component instead of the <qds-button> custom element in the example below:

import { QdsButton } from '@quartzds/core-react'

const MyComponent = () => (
  <QdsButton importance="emphasized" text="Click me"></QdsButton>
)

export default MyComponent

Event Handling

Many Quartz core components emit custom events. For example, the input component emits the qdsInput event when it receives input. In React, you can listen to the event using onQdsInput.

Here's how you can bind the input's value to a state variable:

import { useState } from 'react'
import { QdsInput } from '@quartzds/core-react'

function MyComponent() {
  const [value, setValue] = useState('')

  return (
    <QdsInput
      value={value}
      onQdsInput={(event) => setValue(event.target.value)}
    />
  )
}

export default MyComponent

⚖️ License

See the LICENSE file for license rights and limitations.

Readme

Keywords

none

Package Sidebar

Install

npm i @quartzds/core-react

Weekly Downloads

158

Version

1.0.0-beta.1

License

LGPL-2.1-only

Unpacked Size

48.2 kB

Total Files

43

Last publish

Collaborators

  • quartzds-bot
  • quartzfm