Skip to content
Gravity Logo / Docs Gravity home
Browse documentation
Documentation/Gravity Web

Social

Social Share

The SocialShare component is a sharing widget for Facebook, Twitter, LinkedIn, and email. It provides buttons to share a URL with a description on these social platforms.

Usage

import { SocialShare } from 'components/lib';

function MyComponent({ ...props }){

  const url = 'https://example.com';
  const description = 'Check out this amazing website!';

  return (
    <div>
      <SocialShare url={ url } description={ description } />
    </div>
  );
}

Props

PropDescriptionvalue
classNamecustom stylesoptionalSCSS or Tailwind style
descriptiontext for the social media postrequiredstring
urlurl of the page to sharerequiredstring

Notes

  • The SocialShare component uses the Button component from 'components/lib' to create sharing buttons.
  • The networks object defines the sharing URLs for Facebook, Twitter, LinkedIn, and email.
  • The className prop allows for custom styling to be applied.
  • The description prop provides the text for the social media post.
  • The url prop specifies the URL of the page to share.

Social Sign-In

Gravity Web includes buttons for Facebook and Twitter. Configure their server-side providers before enabling the buttons.

Usage

import { SocialSignin } from 'components/lib';

function MyComponent({ ...props }){

  const networks = ['facebook', 'twitter'];

  return (
    <div>
      <SocialSignin network={ networks } />
    </div>
  );
}

Props

PropDescriptionRequiredValue
classNamecustom styleoptionalSCSS or Tailwind
inviteuser is being invited as a childoptionalboolean
networkarray of social network namesrequiredarray
signupuser is signing up a new accountoptionalboolean

Notes

  • The SocialSignin component uses the Button, cn, Grid, and useTranslation components from 'components/lib'.
  • The network prop specifies the list of social networks for sign-in/sign-up, each represented as a string.
  • The invite and signup props control whether the user is invited as a child or signing up, respectively.
  • The className prop allows for custom styling to be applied.
  • The loading state is managed for each network button to indicate loading status.
  • The serverURL is constructed based on the current environment settings.