MDXTS is now Omnidoc
Back to ExportedTypes

Basic

View Source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { ExportedTypes } from 'mdxts/components'

const sourceFileText = `
import React from 'react'

export function Button({
  children,
  onPress,
}: {
  children: React.ReactNode
} & PressProps) {
  const props = usePress({ onPress })
  return <button {...props}>{children}</button>
}

export type PressProps = {
  /** Function to call when the button is pressed. */
  onPress: () => void
}

export function usePress({ onPress }: PressProps) {
  return { onPress }
}
`

export function Basic() {
  return <ExportedTypes filename="Button.tsx" value={sourceFileText} />
}

Button

children *

React.ReactNode

onPress *

() => void

Function to call when the button is pressed.

usePress

onPress *

() => void

Function to call when the button is pressed.