Back to Tamagui

Unspaced

code/tamagui.dev/data/docs/components/unspaced/2.0.0.mdx

1.144.4775 B
Original Source

While the space property is deprecated, Unspaced lives on in a better form, one which is easily back-ported to add Unspaced support (as well as adding gap support).

When using the space style prop, you may want some children to not be spaced. Use Unspaced:

Usage

tsx
import { Text, Unspaced, View } from '@tamagui/core'

export default () => (
  <View position="relative" space>
    <View width={20} height={20} />
    <View width={20} height={20} />
    <Unspaced>
      <Text position="absolute">Some absolute positioned text</Text>
    </Unspaced>
  </View>
)

If you want the item to be visually hidden as well as unspaced, see VisuallyHidden, which uses Unspaced but also hides the contents in an accessible manner.