Skip to content
Logo Docs02

Lorem Ipsum

Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit dolor vitae, rem, harum consequuntur nisi cum sapiente cupiditate perspiciatis culpa tenetur nemo excepturi ratione error enim hic neque quod inventore!

Lorem ipsum dolor sit amet consectetur adipisicing elit Lorem ipsum or Lorem ipsum.

Lorem Ipsum

Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit dolor vitae, rem, harum consequuntur nisi cum sapiente cupiditate perspiciatis culpa tenetur nemo excepturi ratione error enim hic neque quod inventore!

src/user-components/LoremIpsum.astro
---
// Component Script (JavaScript)
---
<!-- Component Template (HTML + JS Expressions) -->

Lorem Ipsum

Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit dolor vitae, rem, harum consequuntur nisi cum sapiente cupiditate perspiciatis culpa tenetur nemo excepturi ratione error enim hic neque quod inventore!

Eum nec sem vel consulere spiral id alias sem DevoTiones cras lius per quos te moreae eros nonullis. Quis eum fortuna:

  • iugulatur minus Eorum Porro hibernorum
  • postulatu proin consulere discernere, nisi Louor
  • molestias nibh, typi m ESSE ille
  • solatium statera fuga ab NON ea utrumque
  • inceptos ordinario nisl eum elit proponent si quae molestie
src/user-components/MyComponent.astro
---
import SomeLoremIpsumComponent from '../components/SomeLoremIpsumComponent.astro';
import SomeReactComponent from '../components/SomeReactComponent.jsx';
import someData from '../data/pokemon.json';
// Access passed-in component props, like `<X title="Hello, World" />`
const { title } = LoremIpsum.props;
// Fetch external data, even from a private API or database
const data = await fetch('SOME_SECRET_API_URL/users').then(r => r.json());
---
<!-- Your template here! -->

Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit dolor vitae, rem, harum consequuntur nisi cum sapiente cupiditate perspiciatis culpa tenetur nemo excepturi ratione error enim hic neque quod inventore!

Lorem Ipsum

The component template is below the code fence and determines the HTML output of your component.

If you write plain HTML here, your component will render that HTML in any Astro page it is imported and used.

Harusen, consilio polona odio crudeles SacrIlegum consequatur, Eodem <liber> rem <victor> quia, offensam occasionem, eum origine Augue saevientis. Odio quo lucern saevuli si est perpetuum patria hac ac urna te dui porvigere consilio ut quaeque invocatione-eiusdem QUOS.

src/user-components/LoremIpsum.astro
---
// Your component script here!
import Banner from '../components/Banner.astro';
import ReactPokemonComponent from '../components/ReactPokemonComponent.jsx';
const myFavoritePokemon = [/* ... */];
const { title } = Astro.props;
---
// Your component script here!
import Banner from '../components/Banner.astro';
import ReactPokemonComponent from '../components/ReactPokemonComponent.jsx';
const myFavoritePokemon = [/* ... */];
const { title } = LoremIpsum.props;
---
<!-- HTML comments supported! -->
{/* JS comment syntax is also valid! */}
<Banner />
<h1>Hello, world!</h1>
<!-- Use props and other variables from the component script: -->
<p>{title}</p>
<!-- Include other UI framework components with a `client:` directive to hydrate: -->
<ReactPokemonComponent client:visible />
<!-- Mix HTML with JavaScript expressions, similar to JSX: -->
<ul>
{myFavoritePokemon.map((data) => <li>{data.name}</li>)}
</ul>
<!-- Use a template directive to build class names from multiple strings or even objects! -->
<p class:list={["add", "dynamic", {classNames: true}]} />

Lorem Ipsum

Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit dolor vitae, rem, harum consequuntur nisi cum sapiente cupiditate perspiciatis culpa tenetur nemo excepturi ratione error enim hic neque quod inventore!

src/user-components/ButtonGroup.astro
---
import Button from './Button.astro';
---
<div>
<Button title="Button 1" />
<Button title="Button 2" />
<Button title="Button 3" />
</div>