Add to Your App
You are building an app and want to add one specific feature. Find the matching page below. Every page opens with a working example you can adapt.
Pages and navigation
- Add and connect pages: add more pages, connect them with buttons and links, and offer a way back.
- Show different content: build one page that changes with the situation, including a random result.
Information
- Ask the user for information: collect input with text boxes, checkboxes, and dropdowns, and check the answers.
- Remember a score or choice: keep values between clicks and across pages.
- Show a collection of items: display lists and tables built from your data, with a button for each item or a search box.
- Use pictures: show, upload, and edit images.
- Upload and download files: move files into and out of your app, let visitors save and load their data, and split your program across several files.
Behavior
- Add live behavior: react to typing without a full page change.
- Make things happen over time: add countdowns, ticks, and clocks.
Appearance
- Change the appearance: choose among themes, styling helpers, and CSS, ordered by effort.
- Embed HTML: use raw HTML when components are not enough.
Quality
- Test a feature: write focused tests for your routes.
- Use pytest or unittest: run your tests with the tools other Python projects use.
- Freeze finished pages: generate regression tests from the pages you visit and approve.
More you can add
Drafter can do more than the pages above cover. The tour What Drafter can do gives each of these features a short example, project ideas, and a link to the reference page with the details.
- Play sound: play tones and melodies without any sound files.
- Record the visitor's voice: capture audio clips and play them back.
- Use the camera: take a photo inside your app and edit it.
- Show a map: put markers on a real map and read the visitor's location.
- Listen to the room: react to how loud the microphone hears the room.
- Draw charts: turn your data into plots and drawings.
- Use other Python libraries: import libraries beyond Drafter, in the browser.
How these pages work
Each task page follows the same shape: the smallest working example comes first, then variations, then common problems. Every page ends with the same four links:
- Understand it leads to the concept behind the recipe.
- See another example shows the same idea in a different app.
- Look it up gives the exact parameters in the reference.
- Fix a problem covers the errors this feature usually produces.