@react-xray/ui-components
v0.0.1
Published
Shared UI primitives for the React XRay package ecosystem.
Downloads
33
Readme
@react-xray/ui-components
Shared UI primitives for the React XRay package ecosystem.
Use this package when building a plugin. These components match the widget's existing look and feel, especially toolbar controls, action-panel controls, overlays, and small layout helpers.
Stable exports across current entrypoints
These are the symbols currently present in both src/index.tsx and the production stub surface (src/index.prod.ts / dist/index.prod.d.ts).
Action and input primitives
ButtonIconButtonToolbarButtonTextarea
Layout and small helpers
PanelHeaderSeparatorKbd,KbdGroup
Overlay and selection primitives
TooltipPopoverDropdownMenuSelectComboboxpanelPopupStyle
Icons
ChatBubbleIconChevronRightIconClipboardIconCollapseIconExpandIconFolderIconOpencodeIconOpenInEditorIconSaveIconSettingsIconTrashIconXIcon
Intended usage for package authors
- Prefer these primitives over package-local replacements when you need standard buttons, headers, menus, selects, or text inputs.
- Keep styling inline. These components are designed to be extended with
styleprops and the shared inline-style approach used throughout this repo. - For portal-based UI inside the XRay widget, render into the widget portal container instead of
document.body. In practice, package authors typically pair this package withuseWidgetPortalContainer()from@react-xray/core. - Keep examples and public imports limited to the shared surface available across the package's current conditional entrypoints.
Example
import { useWidgetPortalContainer } from '@react-xray/core'
import {
Button,
IconButton,
OpenInEditorIcon,
PanelHeader,
Tooltip,
} from '@react-xray/ui-components'
export function ExamplePanel() {
const portalContainer = useWidgetPortalContainer()
return (
<div>
<PanelHeader
title="Preview"
actionsRender={
<Tooltip label="Open in editor" container={portalContainer}>
<IconButton aria-label="Open in editor">
<OpenInEditorIcon size={14} />
</IconButton>
</Tooltip>
}
/>
<Button variant="secondary">Refresh</Button>
</div>
)
}