Giter Club home page Giter Club logo

sidebar-template's Introduction

Welcome to Reflex!

This is the base Reflex template - installed when you run reflex init.

If you want to use a different template, pass the --template flag to reflex init. For example, if you want a more basic starting point, you can run:

reflex init --template blank

About this Template

This template has the following directory structure:

├── README.md
├── assets
├── rxconfig.py
└── {your_app}
    ├── __init__.py
    ├── components
    │   ├── __init__.py
    │   └── sidebar.py
    ├── pages
    │   ├── __init__.py
    │   ├── dashboard.py
    │   ├── index.py
    │   └── settings.py
    ├── styles.py
    ├── templates
    │   ├── __init__.py
    │   └── template.py
    └── {your_app}.py

See the Project Structure docs for more information on general Reflex project structure.

Adding Pages

In this template, the pages in your app are defined in {your_app}/pages/. Each page is a function that returns a Reflex component. For example, to edit this page you can modify {your_app}/pages/index.py. See the pages docs for more information on pages.

In this template, instead of using rx.add_page or the @rx.page decorator, we use the @template decorator from {your_app}/templates/template.py.

To add a new page:

  1. Add a new file in {your_app}/pages/. We recommend using one file per page, but you can also group pages in a single file.
  2. Add a new function with the @template decorator, which takes the same arguments as @rx.page.
  3. Import the page in your {your_app}/pages/__init__.py file and it will automatically be added to the app.

Adding Components

In order to keep your code organized, we recommend putting components that are used across multiple pages in the {your_app}/components/ directory.

In this template, we have a sidebar component in {your_app}/components/sidebar.py.

Adding State

As your app grows, we recommend using substates to organize your state.

You can either define substates in their own files, or if the state is specific to a page, you can define it in the page file itself.

sidebar-template's People

Contributors

picklelo avatar lendemor avatar owlur avatar

Watchers

 avatar  avatar

Forkers

owlur irahmat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.