@convex-nudge/core
v1.1.1
Published
A beautiful and customizable Convex Nudge component for multiple frameworks
Downloads
62
Readme
@convex-nudge/core
Core functionality for Convex Nudge components. This package provides the base styles, types, and utilities used by all framework-specific implementations.
Installation
npm install @convex-nudge/core
# or
yarn add @convex-nudge/core
# or
pnpm add @convex-nudge/coreUsage
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 componentAPI
Types
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;
};Utilities
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
Style Constants
CONTAINER_STYLES: Base container stylesLINE_STYLES: Line divider stylesLINK_STYLES: Link stylesTEXT_STYLES: Text stylesDISMISS_BUTTON_STYLES: Dismiss button styles
License
MIT
