|
3 | 3 | </p> |
4 | 4 |
|
5 | 5 | # @react-pdf/primitives |
| 6 | + |
| 7 | +Internal element type constants for react-pdf. This package defines the primitive node types used throughout the react-pdf rendering pipeline. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +```bash |
| 12 | +yarn add @react-pdf/primitives |
| 13 | +``` |
| 14 | + |
| 15 | +## Usage |
| 16 | + |
| 17 | +```js |
| 18 | +import { View, Text, Page, Document } from '@react-pdf/primitives'; |
| 19 | + |
| 20 | +console.log(View); // 'VIEW' |
| 21 | +console.log(Text); // 'TEXT' |
| 22 | +console.log(Page); // 'PAGE' |
| 23 | +console.log(Document); // 'DOCUMENT' |
| 24 | +``` |
| 25 | + |
| 26 | +These constants are primarily used internally by react-pdf packages to identify element types during the rendering process. |
| 27 | + |
| 28 | +## Available Primitives |
| 29 | + |
| 30 | +### Document Structure |
| 31 | + |
| 32 | +| Export | Value | Description | |
| 33 | +| ---------- | ------------ | --------------------------------- | |
| 34 | +| `Document` | `'DOCUMENT'` | Root document container | |
| 35 | +| `Page` | `'PAGE'` | Individual page within a document | |
| 36 | +| `View` | `'VIEW'` | Generic container element | |
| 37 | +| `Text` | `'TEXT'` | Text content container | |
| 38 | +| `Link` | `'LINK'` | Hyperlink element | |
| 39 | +| `Note` | `'NOTE'` | Annotation/note element | |
| 40 | +| `Image` | `'IMAGE'` | Image element | |
| 41 | +| `Canvas` | `'CANVAS'` | Custom drawing canvas | |
| 42 | + |
| 43 | +### Form Elements |
| 44 | + |
| 45 | +| Export | Value | Description | |
| 46 | +| ----------- | -------------- | ----------------------------- | |
| 47 | +| `FieldSet` | `'FIELD_SET'` | Form field grouping container | |
| 48 | +| `TextInput` | `'TEXT_INPUT'` | Text input field | |
| 49 | +| `Select` | `'SELECT'` | Dropdown select field | |
| 50 | +| `Checkbox` | `'CHECKBOX'` | Checkbox input field | |
| 51 | +| `List` | `'LIST'` | List element for forms | |
| 52 | + |
| 53 | +### SVG Elements |
| 54 | + |
| 55 | +| Export | Value | Description | |
| 56 | +| ---------------- | ------------------- | -------------------------- | |
| 57 | +| `Svg` | `'SVG'` | SVG root container | |
| 58 | +| `G` | `'G'` | SVG group element | |
| 59 | +| `Path` | `'PATH'` | SVG path element | |
| 60 | +| `Rect` | `'RECT'` | SVG rectangle element | |
| 61 | +| `Line` | `'LINE'` | SVG line element | |
| 62 | +| `Circle` | `'CIRCLE'` | SVG circle element | |
| 63 | +| `Ellipse` | `'ELLIPSE'` | SVG ellipse element | |
| 64 | +| `Polygon` | `'POLYGON'` | SVG polygon element | |
| 65 | +| `Polyline` | `'POLYLINE'` | SVG polyline element | |
| 66 | +| `Tspan` | `'TSPAN'` | SVG text span element | |
| 67 | +| `ClipPath` | `'CLIP_PATH'` | SVG clipping path | |
| 68 | +| `Defs` | `'DEFS'` | SVG definitions container | |
| 69 | +| `Stop` | `'STOP'` | Gradient stop element | |
| 70 | +| `LinearGradient` | `'LINEAR_GRADIENT'` | Linear gradient definition | |
| 71 | +| `RadialGradient` | `'RADIAL_GRADIENT'` | Radial gradient definition | |
| 72 | + |
| 73 | +### Internal Types |
| 74 | + |
| 75 | +| Export | Value | Description | |
| 76 | +| -------------- | ----------------- | --------------------------------------- | |
| 77 | +| `TextInstance` | `'TEXT_INSTANCE'` | Internal representation of text content | |
| 78 | + |
| 79 | +## License |
| 80 | + |
| 81 | +MIT |
0 commit comments