Skip to main content

NeoPopButton

A 3D extruded pressable button with press-sink animation, shimmer support, and 9-position grid placement.

Usage

// dark mode example
import { NeoPopButton } from 'neopop-rn';
import { Text } from 'react-native';

<NeoPopButton
variant="elevated"
size="medium"
colorMode="dark"
onPress={() => console.log('pressed')}
>
<Text style={{ color: '#ffffff' }}>Pay Now</Text>
</NeoPopButton>
// light mode example
import { NeoPopButton } from 'neopop-rn';
import { Text } from 'react-native';

<NeoPopButton
variant="elevated"
size="medium"
colorMode="light"
colorConfig={{ color: '#0d0d0d', edgeColors: { right: '#555555', bottom: '#555555' } }}
onPress={() => console.log('pressed')}
>
<Text style={{ color: '#ffffff' }}>Pay Now</Text>
</NeoPopButton>

Props

PropTypeDefaultDescription
childrenReact.ReactNodeContent rendered inside the button face.
variant'elevated' | 'flat' | 'stroke''elevated'Visual variant. elevated shows 3D edges, flat hides edges, stroke renders a transparent face with a border.
size'big' | 'medium' | 'small''medium'Predefined height and horizontal padding token.
depthnumber3Pixel depth of the 3D right and bottom edge surfaces.
fullWidthbooleanfalseStretches the button to fill its parent's width.
positionButtonPosition'bottomRight'Position in a 3×3 grid; suppresses edges shared with neighbours.
adjacentRightbooleanfalseSuppress the right edge (button is flush against a right neighbour).
adjacentLeftbooleanfalseSuppress the left edge.
adjacentTopbooleanfalseSuppress the top edge.
adjacentBottombooleanfalseSuppress the bottom edge.
colorConfigNeoPopButtonColorConfigPer-token color overrides (see colorConfig table below).
colorMode'dark' | 'light'Picks theme-mode defaults when colorConfig is not provided.
shimmerConfigNeoPopButtonShimmerConfigEnables and configures the shimmer overlay.
onPress() => voidCalled when the button is tapped.
onLongPress() => voidCalled on long-press.
onPressIn() => voidCalled when the finger touches down.
onPressOut() => voidCalled when the finger lifts.
disabledbooleanfalseDisables interaction and applies 40% opacity.
enableHapticsbooleanfalseFires a light impact haptic on press-in.
animationDurationnumberBUTTON_PRESS_DURATION_MSDuration of the press-down timing animation in ms.
springConfigWithSpringConfigCustom spring config for the press-release animation.
accessibilityLabelstringAccessibility label for screen readers.
accessibilityHintstringAccessibility hint for screen readers.
styleStyleProp<ViewStyle>Additional style applied to the Pressable wrapper.

NeoPopButtonShimmerConfig

FieldTypeDefaultDescription
enabledbooleanRequired. Turns the shimmer overlay on or off.
colorstring'rgba(255,255,255,0.35)'Shimmer strip color.
widthnumberSHIMMER_WIDTHWidth of the primary shimmer strip.
gapnumberSHIMMER_GAP_WIDTHGap between the two shimmer strips.
durationnumberSHIMMER_DURATION_MSTime in ms for one sweep.
delaynumberSHIMMER_DELAY_MSInitial delay before first sweep.
repeatDelaynumberSHIMMER_DELAY_MSPause between repeated sweeps.

ButtonPosition values

'topLeft' | 'topEdge' | 'topRight' | 'leftEdge' | 'center' | 'rightEdge' | 'bottomLeft' | 'bottomEdge' | 'bottomRight'

colorConfig

KeyDescription
colorFace background color.
edgeColors.topColor of the top edge surface.
edgeColors.rightColor of the right edge surface.
edgeColors.bottomColor of the bottom edge surface.
edgeColors.leftColor of the left edge surface.
borderColorBorder color used in stroke variant.
disabledColorFace color when disabled is true.
disabledEdgeColorEdge color when disabled is true.

Notes

  • The component requires react-native-reanimated (v3+) for its press animation.
  • Shimmer wraps the button in NeoPopShimmer, which uses overflow: 'hidden' on the container; avoid applying border-radius via style when shimmer is enabled — apply it inside the button face content instead.
  • position suppresses edges automatically; it is distinct from adjacentRight/Left/Top/Bottom, which are for explicit neighbour-sharing.
  • In the stroke variant, edgeColors are ignored and edges are never rendered.