Bedform UIGuides

Composition

Compose OreUI components from ordinary React elements.

Components render ordinary DOM elements, with no Shadow DOM, so they can be styled and composed like any other markup.

import { Button } from "@bedform/ui/button";
import { Card } from "@bedform/ui/card";

<Card>
  <div className="ore-card-body">
    <div className="ore-card-caption">
      <h2 className="ore-card-title">Realm settings</h2>
      <p className="ore-card-description">Choose how players join.</p>
    </div>
    <Button type="button">Save</Button>
  </div>
</Card>;

Complex components use public classes to identify their parts, which have no components of their own:

import { Button } from "@bedform/ui/button";
import { Dropdown } from "@bedform/ui/dropdown";

<Dropdown value="survival">
  <Button className="ore-dropdown-trigger" type="button">
    Game mode
  </Button>
  <div className="ore-dropdown-menu">
    <button className="ore-dropdown-item" type="button" data-value="survival">
      Survival
    </button>
    <button className="ore-dropdown-item" type="button" data-value="creative">
      Creative
    </button>
  </div>
</Dropdown>;

The elements of the parts can be changed as long as their classes stay the same.