Skip to main content

Create Simple Component

To create a new component of an HTML element or other component, connect the atomize library:

import atomize from "@quarkly/atomize";

Atomize is a wrapper for styled-components and has a similar API. Just call the method using the name of the desired HTML element. For example, create a new element from a button:

const MyButton = atomize.button();

You can also create a new component from an existing one:

  • An example of how to create a component from an imported one:

    import { Button } from "@quarkly/widgets";
    const MyButton = atomize(Button);
  • An example of how to create a component from an existing one:

    const Button = ({ children }) => {
    // some logic here
    return <button>{children}</button>;
    };
    const MyButton = atomize(Button);
  • As a result, we get a React component that can accept any CSS style or parameter, for example:

    <MyButton color="red" />