hypra

COMP-010: content without a slot

Error: the page doesn't build until this is fixed.

Content inside a component call goes where the component's body says slot. A component without a slot has nowhere to put it, and it would disappear.

Fails

component Badge(text: Text) { span(class: "badge") "{text}" }

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  Badge(text: "New") { p "Just in" }
}
error[COMP-010]: `Badge` has no `slot`, so the content given to it would disappear
 --> page.hypra:5:3
  |
5 |   Badge(text: "New") { p "Just in" }
  |   ^^^^^
  = help: put the content next to the call instead of inside it, or add `slot` to the component
  = docs: https://hypralang.dev/rules/comp-010/

1 error, 0 warnings

Fixed

component Badge(text: Text) {
  span(class: "badge") "{text}"
  slot
}

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  Badge(text: "New") { p "Just in" }
}