Interface and navigation
Interface
Navigation
Learn to navigate the Luna Park interface and understand the different panels.
Feature Tour (Episode 2)
Back to the Academy
Interface and navigation
Quick summary: Learn to create reusable components with styling, slots, and customizable properties.
Introduction
This tutorial teaches component creation in Luna Park. A component is a reusable visual element that you can use multiple times throughout your application.
1. Project preparation
Clean the workspace
- Delete any existing files: right-click → Delete
- Create a new component: right-click → New → Component
2. Basic element: the div
Fundamental concept
- The div is the basic building block (like a brick for construction)
- By default: divs have width and height = 0, making them invisible
- You must add size properties to make them visible
Create multiple divs
- Click the + to add elements
- Each new element is a div by default
3. Element styling
Add dimensions
- Select a div element
- Go to Inspector → Style tab → click +
- Choose the Size category
- Set min-width and min-height (example: 57px)
Add color
- In the Background category, click Color
- Choose a color (example: red)
- Tip: Use the eye icon to hide unused properties and keep your workspace clean
Default behavior
- Divs automatically take the full available width of their container
- Elements automatically inherit sizes from similar nearby elements
4. Display management with Flexbox
Problem: elements stack vertically by default
Solution: Use display: flex on the parent container to arrange elements horizontally
Flex configuration
- Select the parent element (container)
- Add Display property → Flex
- Available options:
- Direction: horizontal/vertical
- Align items: perpendicular alignment
- Justify content: main alignment
- Gap: spacing between elements
Common alignment options
- Left/Right: Align elements horizontally to left or right
- Center: Center elements in their container
- Stretch: Make all elements the same size by stretching
5. Creating a button component
Basic structure
- Start from a simple div
- Clear previous styles
- Define fixed size: min-width and height
Add text
- Click + → Custom Text
- Type your desired text
- Markdown is supported (example: use
**bold**with asterisks to make text bold)
Button styling
Background:
- Color: dark blue
Text centering:
- Display: flex
- Align items: center
- Justify content: center
Spacing:
- Padding: inner space
- Margin: outer space
Borders:
- Border → color, style (solid/dotted), size (2px)
- Border radius: rounded corners
6. Using components
Create a page
- New component with Type: Page
- A page is directly accessible in the application
- Automatic browser display
Rename for better organization
- Rename the button component to "color-blocks"
- Rename the page to "my-page"
Instantiate the component
- + → type change icon
- Component → select "color-blocks"
- The component appears with its styles
Reusability
- Duplicate with + and selection of the same component
- Modifying the original component updates all its instances
7. Slots for dynamic content
Problem: static content
Currently, all button instances display identical text because the content is hardcoded.
Solution: Use slots for dynamic content
- Click + → Slot
- The dotted border indicates where content can be inserted
- Default content: This text appears when no custom content is provided
Using slots in your page
- Select a component instance in your page
- Click + → Custom Text inside the component
- Your custom text will replace the slot's default content
Named slots for multiple content areas
Use case: When you need multiple customizable areas (example: icon + text)
- First slot: Set name = "emoji"
- Second slot: Leave as default (no name)
- Add gap property for spacing between elements
- Each named slot can receive completely different content
How multiple slots behave
- Unnamed slots: Content is duplicated and synchronized across all instances
- Named slots: Each has independent, customizable content
- Important: Changes to default slot content affect all instances using that slot
Integrated CSS concepts
Display modes
- Block: full width by default
- Inline: content width
- Flex: advanced layout control
Spacing
- Padding: inner space (affects apparent size)
- Margin: outer space (doesn't affect element size)
Flexbox
- Direction: row (horizontal) / column (vertical)
- Justify: main axis alignment
- Align: secondary axis alignment
- Gap: uniform spacing between children
Component advantages
- Reusability: one component, multiple instances
- Maintenance: centralized modification
- Consistency: uniform design
- Flexibility: slots for customization