Skip to content

packages/core/src/lib/element/fragment.ts

Read as Markdown

This is the source snapshot used to build these API details. View this revision on GitHub.

Back to reference

1 import type { PibblElement, PibblNodeInput } from './types.js';
2 
3 export interface FragmentProps {
4   children?: PibblNodeInput;
5 }
6 
7 /**
8  * Compiler-visible fragment value. The renderer handles its descriptor directly.
9  *
10  * @param props - Children and optional fragment identity. See {@link FragmentProps}.
11  * @returns The fragment's children, preserving their order. See {@link PibblNodeInput}.
12  *
13  * @see {@link PibblNodeInput}
14  */
15 export function Fragment(props: FragmentProps): PibblNodeInput {
16   return props.children;
17 }
18 
19 /** @internal */
20 export function isFragmentElement(
21   element: PibblElement<any>,
22 ): element is PibblElement<FragmentProps> {
23   return element.type === Fragment;
24 }
25 

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.