Gravity
  • Welcome to Gravity
  • Getting Started
  • Stack
  • Updates
  • Rules For AI
  • Troubleshooting
  • Gravity Server
    • Introduction
    • Installation
      • Install Node.js
      • Database Setup
      • Stripe Setup
      • Mailgun Setup
      • Install Gravity
    • Application Structure
    • REST API
      • API Scopes
      • Webhooks
    • Authentication
      • Email Verification
      • Social Sign On
      • Two-Factor Authentication
    • Authorization
      • Feature Access and Plan Restrictions
      • Permissions (Roles)
    • Config
    • Environment Variables
    • Database Queries
    • Handling Errors
    • Logging
    • Localization
    • Push Notifications
    • Email Notifications
    • User Feedback
    • User Onboarding
    • File Uploads
    • Billing
      • Seat Billing
      • Usage Billing
    • Free Accounts
    • CLI Toolbelt
    • Testing
    • AI Tools
    • Background Jobs
    • Deployment
  • Gravity Web
    • Introduction
    • Tailwind & SCSS
    • Routing
    • Events
    • Authentication
    • Localization
    • Hooks
      • useAPI
      • usePlans
      • usePermissions
    • Components
      • Alert
      • Animate
      • Avatar
      • Badge
      • Breadcrumb
      • Button
      • Calendar
      • Card
      • Chart
      • Checklist
      • Credit Card
      • Detail
      • Dialog
      • Dropdown
      • Feedback
      • Form
      • Grid
      • Header
      • Helper
      • Icon
      • Image
      • Layout
      • Link
      • List
      • Loader
      • Logo
      • Nav
      • Onboarding
      • Pagination
      • Popover
      • Progress
      • Row
      • Search
      • Separator
      • Sheet
      • Social
      • Stat
      • Table
      • Tabs
      • Toast (Notification)
      • Tooltip
      • User
      • View
    • Views
    • Handling Errors
    • Deployment
  • Gravity Native
    • Introduction
    • Prerequisites
    • Installation
    • App Context
    • Authentication
    • Localisation
    • External Linking
    • Handling Errors
    • Navigation
    • Config
    • Events
    • Views
    • Components
      • Badge
      • Blankslate
      • Button
      • Card
      • Chart
      • Form
      • Global
      • Grid
      • Icon
      • List
      • Logo
      • Message
      • Modal
      • Nav
      • Notification
      • Progress Bar
      • Search
      • Separator
      • Social
      • Stat
      • View
    • Push Notifications
    • Payments
    • Building Your App
  • Mission Control
    • Introduction
    • Installation
    • User Management
    • Feedback
    • Events
    • Logs
  • Website Template
    • Introduction
    • Environment Variables
    • Styling
    • Components
      • Article
      • Feature List
      • Footer
      • Hero
      • Layout
      • Pricing
      • Meta Data
      • Nav
      • Testimonial
    • Build and Deploy
Powered by GitBook
On this page
  • Standard Button
  • Preview
  • Props
  • ‌Text Button
  • Props
  • Loading Button
  • Icon Button
  • Props

Was this helpful?

  1. Gravity Native
  2. Components

Button

PreviousBlankslateNextCard

Last updated 1 year ago

Was this helpful?

There are three button components available: standard, text and icon.

Standard Button

<Button
  text='Save'
  action={ save }
  params={{ id: 3141 }}
/>

Preview

Props

Prop
Description
Required
Value

action

callback function executed on click

optional

function

color

text color

optional

white (default), grey, green, red, orange, purple, blue or hex value

background

background color

optional

green (default), grey, red, orange, purple, blue or hex value

fontSize

text size

optional

integer

icon

icon image

optional

string

iconColor

icon color

optional

string (default: white)

iconSize

icon size

optional

integer (default: 20)

loading

toggle loading spinner

optional

boolean

params

object passed to action callback

optional

object

style

custom class

optional

style object

text

button label

required

string

url

internal url to navigate to instead of action

optional

string

‌Text Button

Plain text button.

<TextButton
  color='red',
  text='Save'
  action={ save }
/>

Props

Prop
Description
Required
Value

action

callback function executed on click

optional

function

color

text color

optional

string (default: Global.color.text)

params

object passed to callback action

optional

object

style

custom style

optional

style object

text

button label

required

string

Loading Button

If an action takes some time to process, you can pass a loading prop to a <Button> component to provide visual feedback to the user.

<Button
  loading={ loading }
  text='Click Me'
/>

Icon Button

An icon button with optional text label.

<IconButton
  image='save'
  size={ 20 }
  action={ save }
/>

Props

Prop
Description
Required
Value

action

callback function executed on click

required

function

background

background color

optional

string (default: transparent)

color

color of the icon

optional

dark, light or hex value

image

required

params

object passed back in the callback

optional

object

size

icon size

optional

integer (default: 20)

style

custom style

optional

style object

text

button label

required

optional

textColor

text color

optional

string (default: Global.color.text)

image

​​

icon
refer to feather icons