Skip to content

Commit b417241

Browse files
authored
Update built-in meta component API section (#300)
* Add more examples * Clarify what `is` can actually accept as its value * Remove redundant types (ComponentConstructor is not described anywhere)
1 parent 9ebf89e commit b417241

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/api/built-in-components.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
- **Props:**
66

7-
- `is` - `string | ComponentDefinition | ComponentConstructor`
7+
- `is` - `string | Component`
88

99
- **Usage:**
1010

11-
A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop:
11+
A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop. An `is` prop as a string could be either an HTML tag name or a Component name.
12+
13+
- **Example:**
1214

1315
```html
1416
<!-- a dynamic component controlled by -->
@@ -17,6 +19,12 @@
1719

1820
<!-- can also render registered component or component passed as prop -->
1921
<component :is="$options.components.child"></component>
22+
23+
<!-- can reference components by string -->
24+
<component :is="condition ? 'FooComponent' : 'BarComponent'"></component>
25+
26+
<!-- can be used to render native HTML elements -->
27+
<component :is="href ? 'a' : 'span'"></component>
2028
```
2129

2230
- **See also:** [Dynamic Components](../guide/component-dynamic-async.html)

0 commit comments

Comments
 (0)