MyGit
🚩收到GitHub仓库的更新通知

tamagui/tamagui

Fork: 396 Star: 9869 (更新于 2024-04-11 00:23:27)

license: MIT

Language: TypeScript .

Style React fast with 100% parity on React Native, an optional UI kit, and optimizing compiler.

最后发布版本: v1.94.4 ( 2024-04-06 07:30:34)

官方网址 GitHub网址

✨免费申请网站SSL证书,支持多域名和泛域名,点击查看
Tamagui

Style and UI for React (web and native) meet an optimizing compiler

NPM downloads Discord users online Commits per month


  • @tamagui/core - Universal style library for React.
  • @tamagui/static - Optimizing compiler that works with core and tamagui.
  • tamagui - UI kit that adapts to every platform.

See tamagui.dev for documentation.

Tamagui lets you share more code between web and native apps without sacrificing the two things that typically suffer when you do: performance and code quality.

It does this with an optimizing compiler that outputs platform-specific optimizations - it turns styled components, even with complex logic or cross-module imports, into a simple div alongside atomic CSS on the web, or a View with its style objects hoisted on native.

The entirety of Tamagui works at compile time and runtime, and can be set up gradually, with initial usage as simple as importing it and using the base views and styled function.

We recommend checking out the starters with npm create tamagui@latest, they range from a simple learning example to a production-ready monorepo.

The compiler optimizes most and ultimately flattens a majority of styled components. In the ~500px² responsive browser section of the Tamagui website, 49 of the 55 or so inline styled components are flattened to a div. The homepage gains nearly 15% on Lighthouse with the compiler on.

Learn more on the website.

Installing Tamagui

To install Tamagui with all its components run:

npm install tamagui @tamagui/config

Next, create a Tamagui config file named tamagui.config.ts:

import { config } from '@tamagui/config/v3'

import { createTamagui } from 'tamagui'
const tamaguiConfig = createTamagui(config)
// this makes typescript properly type everything based on the config

type Conf = typeof tamaguiConfig

declare module 'tamagui' {

  interface TamaguiCustomConfig extends Conf {}

}
export default tamaguiConfig
// depending on if you chose tamagui, @tamagui/core, or @tamagui/web
// be sure the import and declare module lines both use that same name

Note: The v3 config imports the @tamagui/animations-css driver on web and @tamagui/animations-react-native on native. You can change these as you please, we provide exports for animationsCSS and animationsNative. If you want to use Reanimated, you can copy and paste this code and pass it as animations to createTamagui.

Usage

To use Tamagui in your Expo or Next.js projects, all you need to do is wrap your application in the TamaguiProvider:

// this provides some helpful reset styles to ensure a more consistent look
// only import this from your web app, not native
import '@tamagui/core/reset.css'

import { TamaguiProvider } from 'tamagui'
import tamaguiConfig from './tamagui.config'

export default function App() {
  return (
    <TamaguiProvider config={tamaguiConfig}>
      {/* your app here */}
    </TamaguiProvider>
  )
}

Done! Now try out some components:

import { Button, Text } from 'tamagui'

function Example() {
  return (
    <Button>
      <Text>My button</Text>
    </Button>
  );
}

Contributing

To contribute to Tamagui reference the contributing guide.

To contribute to documentation reference the writing guide.

最近版本更新:(数据更新于 2024-04-11 00:23:10)

2024-04-06 07:30:34 v1.94.4

2024-04-04 09:53:26 v1.94.3

2024-04-04 03:10:41 v1.94.2

2024-04-02 03:20:56 v1.94.1

2024-04-01 05:06:25 v1.94.0

2024-03-29 05:32:09 v1.93.3

2024-03-27 04:18:58 v1.93.2

2024-03-27 03:54:59 v1.93.1

2024-03-27 03:26:40 v1.93.0

2024-03-23 08:42:56 v1.92.1

主题(topics):

atomic-css, css-in-js, optimizing-compiler, react, react-native, react-native-web, tailwind, typescript, ui, ui-components, vite, webpack

tamagui/tamagui同语言 TypeScript最近更新仓库

2024-04-18 12:07:42 labring/FastGPT

2024-04-18 09:36:58 siyuan-note/siyuan

2024-04-17 20:13:46 n8n-io/n8n

2024-04-17 17:45:16 lobehub/lobe-chat

2024-04-17 08:45:31 quilljs/quill

2024-04-16 23:46:08 vuetifyjs/vuetify