uce/site/doc/pages/component_exists.txt

24 lines
716 B
Plaintext

:sig
bool component_exists(String name)
:see
>ob
component
component_render
component_resolve
1_COMPONENT
:content
Checks whether a component file can be resolved from the current page context.
Resolution tries the exact name first and then the `components/` shorthand form.
If `name` contains a colon, only the file portion is used for existence checks.
This is useful when a page wants to render an optional component if it is present without hard-failing when it is missing.
## Related Concepts
- PHP: `function_exists()`, `class_exists()`, or file-existence checks before including a partial
- JavaScript / Node.js: module existence checks, dynamic import guards, or registry lookups for named components