Core functionality for Convex Nudge components. This package provides the base styles, types, and utilities used by all framework-specific implementations.
npm install @convex-nudge/core
# or
yarn add @convex-nudge/core
# or
pnpm add @convex-nudge/core
This package is primarily used internally by the framework-specific packages. However, you can use it directly if you want to create your own implementation:
import {
getThemeColors,
getPositionStyles,
getAnimationStyles,
getTextSize,
getAnimationKeyframes,
CONTAINER_STYLES,
LINE_STYLES,
LINK_STYLES,
TEXT_STYLES,
DISMISS_BUTTON_STYLES,
getConvexUrl,
getInlineSvgUrl,
type NudgeOptions
} from '@convex-nudge/core';
// Use the utilities to create your own nudge component
type NudgeOptions = {
className?: string;
referralCode?: string;
logoSize?: number;
textSize?: 'xs' | 'sm' | 'base';
variant?: 'light' | 'dark' | 'purple' | 'blue';
position?: 'top' | 'bottom' | 'left' | 'right' | 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
animation?: 'slide' | 'fade' | 'none';
fixed?: boolean;
dismissible?: boolean;
zIndex?: number;
};
getThemeColors(variant)
: Get color scheme for a theme variantgetPositionStyles(position, fixed, zIndex)
: Get positioning stylesgetAnimationStyles(animation, position)
: Get animation stylesgetTextSize(size)
: Get text size in pixelsgetAnimationKeyframes()
: Get CSS keyframes for animationsgetConvexUrl(referralCode)
: Get Convex URL with referral codegetInlineSvgUrl()
: Get the Convex logo SVG URL
CONTAINER_STYLES
: Base container stylesLINE_STYLES
: Line divider stylesLINK_STYLES
: Link stylesTEXT_STYLES
: Text stylesDISMISS_BUTTON_STYLES
: Dismiss button styles
MIT