Lynx Examples
This repository is intended to showcase examples of Lynx.
List of examples
- Benchmarks
7guis: The 7GUIs benchmark — Counter, Temperature Converter, Flight Booker, Timer, CRUD, Circle Drawer, Cells
- Tutorials
hello-world: A minimal hello world exampletutorial-gallery: An example shows how to use discoverPagetutorial-bankcards: An example shows how to use Lynx in bankcards projectcomposing-elements: An example shows how to composing elements in ReactLynxdesign-guide: An example demonstrating design with Lynx capabilities
- Builtin Elements
blur-view: An example shows how to use<blur-view>in Lynxevent: An example shows how touch events workimage: An example shows how to use imageslist: An example shows how to use reusable and scrollable containerscroll-view: An example shows how to use scrollable containertext: An example shows how to use text and inline-textview: An example shows how to use viewframe: An example shows how to use framepage: An example shows how to use page in Lynxrefresh: An example shows how to use<refresh>in Lynxscroll-coordinator: An example shows how to use<scroll-coordinator>in Lynxviewpager: An example shows how to use<viewpager>in Lynxtitle-bar-view: An example shows how to use<title-bar-view>in Lynxnative-element: An example about using native element in Lynxinput: An example shows how to use inputtextarea: An example shows how to use textareaoverlay: An example shows how to use overlayanimax: An example shows how to use<animax-view>in Lynxsvg: An example shows how to use svgvideo: An example shows how to use<video>in Lynx- [
markdown]: An example show how to use markdown
- Styling
animation: Examples for using animationcss: Examples for using different CSSlayout: Examples of the layout related stylingcss-global: An example shows how to use global CSS in Lynxcss-modules: An example shows how to use CSS Modules in Lynxcss-postcss: An example shows how to use PostCSS in Lynxcss-preprocessors: An example shows how to use Sass, Less and Stylus in Lynxtailwindcss: A settings UI with runtime theme switching using Tailwind CSS and CSS variables
- API
fetch: An example shows how to use fetch APIlazy-bundle: An example shows how code-splitting and lazy bundle works, both code-split and built standaloneexternal-bundle: An example shows how to use external bundle in Lynxelement-manipulation: An example shows how to manipulate elements in Lynxlynx-api: An example shows how to use Lynx APIsreact-apis: An example shows how to use ReactLynx APIsmain-thread: An example shows how to use main thread scriptslocal-storage: An example shows how to use local storage in Lynxnetworking: An example shows Lynx networking abilitiesreact-lifecycle: An example shows ReactLynx lifecyclewebassembly: An example shows how to run WebAssembly in Lynx
- Web Platform
basic-usage: An example shows how to use Lynx Web Platform
- UI Components
action-sheet: An example shows how to make an ActionSheetdesktop: Desktop-oriented cursor demos withcursorandmouse-cursorentriesswiper: An example shows how to use main thread script for interaction
- A11y
accessibility: An example shows how to make App accessibility
- Performance
performance-apis: An example shows how to listen an performance entryifr: An example about Instant First-Frame Rendering (IFR) in Lynx
- I18n
i18n: An example shows how to use i18n in Lynx
- Third-party Integrations
openui: An example shows how to render streaming OpenUI responses in Lynxwith-solidjs: An example shows how to use Lynx with SolidJSzustand: An example shows how to use zustand in Lynxtanstack-router: An example shows how to use TanStack Router in Lynx
How to use
- First, clone the current repository to your local:
git clone git@github.com:lynx-family/lynx-examples.git
- Then, choose the example you need, such as the image example:
cd examples/image
- Install the dependencies using
pnpmor other package manager, then start the project:
# Use corepack to enable pnpm
corepack enable
pnpm i
pnpm run dev
- You can fork the current project or copy the code from the current project to use it.
How to use examples on the lynx-website
Publish your example to the npm registry.
Go to the project "packages/lynx-example-packages" directory on the lynx-website.
Update packages/lynx-example-packages/package.json dependencies
"dependencies": {
"@lynx-example/xxx": "xxx",
}
- Install dependencies in the lynx-website root directory, then start the project:
pnpm i
pnpm run dev
- Use it in your MDX files:
import { Go } from "@lynx";
<Go
example="xxx"
defaultFile="src/App.tsx"
img="xxx-example-preview.png"
/>;
For more details please see <Go/>