🎨
Valence
🎨
Valence
  • Overview
    • πŸ‘‹Welcome to Valence
    • πŸ„β€β™‚οΈGetting started
  • Core Concepts
    • Responsiveness
    • Color
      • List of colors
      • Color types
    • Polymorphism
  • Valence Core
    • πŸƒβ€β™‚οΈFundamentals
      • 🎬The ValenceProvider
      • ✍️Using custom fonts
    • 🧱Components
      • πŸ”˜Buttons
        • Button with icon
        • Grid Button
        • Text button
        • Icon button
        • Multi-part button
        • Unstyled button
        • Primitive button
      • ⌨️Inputs
        • Color Picker
        • Text input
        • Text area
        • Number input
        • Select input
        • Switch
        • Slider
        • Range slider
        • Pill selector
        • Input container
        • Dropdown container
      • πŸ–₯️Display
        • Accordion
        • Alert
        • Color Swatch
        • Icon
        • Image
        • Avatar
        • Avatar Group
        • Loader
        • Pill
        • Spoiler
        • Stepper
        • Text
        • Title
      • 🧩Layout
        • App Container
        • Card
        • Flex
          • Flex Center
          • Styled Flex
        • Floating Toolbar
        • Grid
        • Header
        • Overflow Container
        • Space
      • πŸ—ΊοΈNavigation
        • App Nav
      • πŸ”ΌOverlays
        • Modal
        • Tooltip
        • Modal background
        • πŸ“°Sheets
          • Bottom Sheet
          • Dynamic Sheet
          • Side Sheet
    • πŸͺHooks
      • UseColorScheme
      • UseColors
      • UseControlledList
      • UseDetectKeyDown
      • UseDisclosure
      • UseFloating
      • UseTooltip
      • UseBreakpoint
      • UseResponsiveProps
    • 🀚Generics
      • Generic button props
      • Generic input props
      • Generic Sheet Props
  • Valence Plugins
    • 🎠Valence Carousel
      • Carousel Child Props
  • Valence Utils
    • βœ‹Generics
      • Clickable
      • Events
      • Global
      • Grid
      • Layout
      • Overlay
      • Polymorphic
    • πŸ§œβ€β™€οΈPolymorphism
      • Polymorphic Button
      • Polymorphic Layout
      • Polymorphic Text
  • Update Notes
    • 3.0.0
    • 2.7.0
    • 2.6.0
    • 2.5.0
    • 2.4.0
    • 2.3.0
    • 2.2.0
    • 2.1.0
    • 2.0.0
Powered by GitBook
On this page
  • Usage
  • The nav prop
  • Centering page content
  • Props
  • Changelog

Was this helpful?

Edit on GitHub
  1. Valence Core
  2. Components
  3. Layout

App Container

Last updated: 3.0.0 (04/07/2024)

PreviousLayoutNextCard

Last updated 11 months ago

Was this helpful?

This component has changed dramatically in Valence 3! .

The AppContainer is an all-in-one component that creates a container in which the content of the app resides. It is designed to adapt responsively across all device classes to provide a consistent yet tailored experience.

Usage

import { AppContainer, AppNav, Button, Header } from "@valence-ui/core";
import { BrowserRouter } from "react-router-dom";
import { IconCategory } from "@tabler/icons-react";

export default function App() { 
    return ( 
        <BrowserRouter>
            <ValenceProvider>
                <AppContainer
                    nav={
                        <AppNav
                            buttons={[
                                {
                                    id: "page1",
                                    children: <IconCategory />,
                                    highlighted: true,
                                    to: "/home",
                                },
                                // More buttons...
                            ]}
                        />
                    }
                >
                    // App content ...
                </AppContainer>
            </ValenceProvider>
        </BrowserRouter>
    )
}

Above is a minimum example, and there are many other props and options to break down about this component.

The nav prop


Centering page content

import { AppContainer, Header, FlexCenter } from "@valence-ui/core";

function Example() { 
    return ( 
        <AppContainer>
            <Header innerWidth="min(100%, 700px)">
                // Header content...
            </Header>
            <FlexCenter innerWidth="min(100%, 700px)">
                // Page contents...    
            </FlexCenter>
        </AppContainer>
    )
}

This change allows greater flexibility in layout and design choices.


Props

Property
Type
Description

nav

ReactNode

The primary root navigation element; this should be consistent across pages.

showNav

boolean

Whether to show the nav element. Defaults to true.


Changelog

  • 3.0.0: Moved the App Container from @valence-ui/app to @valence-ui/core. This component has also received significant updates:

    • header and sidebar are no longer accepted as a prop; sidebars are no longer supported and it is the responsibility of the page content to handle any headers.

    • The App Container also no longer handles centering page content; this is now the responsibility of the page to do this.

The nav prop allows you to insert an element, and will render it down the left of the screen (or on the bottom on mobile breakpoints). It can be hidden by setting the showNav prop to false.

As of Valence 3, the App Container no longer handles default page width within the component, instead handing this responsibility off to the developer. To achieve a similar effect to what could be done in Valence 2, use a component:

Extends & .

🧱
🧩
View the update notes
AppNav
Flex Center
GenericLayoutProps
PolymorphicLayoutProps