App.vue
FoodItem.vue
main.js
 
<template>
  <h1>Food</h1>
  <p>Food description is not provided for 'Pizza' and 'Rice', so the default description is used.</p>
  <div id="wrapper">
    <food-item 
      food-name="Apples" 
      food-desc="Apples are a type of fruit that grow on trees."/>
    <food-item 
      food-name="Pizza"/>
    <food-item 
      food-name="Rice"/>
  </div> 
</template>

<style>
  #wrapper {
    display: flex;
    flex-wrap: wrap;
  }
  #wrapper > div {
    border: dashed black 1px;
    flex-basis: 120px;
    margin: 10px;
    padding: 10px;
    background-color: lightgreen;
  }
</style>                  
<template>
	<div>
		<h2>{{ foodName }}</h2>
		<p>{{ foodDesc }}</p>
	</div>
</template>

<script>
export default {
	props: {
		foodName: {
			type: String,
			required: true
		},
		foodDesc: {
			type: String,
			required: false,
			default: 'This is the food description...'
		}
	}
};
</script>                  
import { createApp } from 'vue'

import App from './App.vue'
import FoodItem from './components/FoodItem.vue'

const app = createApp(App)

app.component('food-item', FoodItem)

app.mount('#app')
                  
http://localhost:5173/