Prerequisites
Before using the Button Widget, make sure you’ve installed the Widgets library.Quick Setup
The fastest way to add a button widget:- Visit your Givebutter Dashboard
- Select your campaign
- Navigate to Sharing > Widgets
- Choose Button as the widget type
- Customize the appearance
- Copy the generated code
- Paste it where you want the button to appear on your site
Manual Setup
For greater control and flexibility, you can manually create button widgets using the<givebutter-button> tag:
Configuration Options
Customize your button’s appearance by adding attributes to the<givebutter-button> element:
Required Attributes
| Attribute | Description | Example |
|---|---|---|
campaign | Your campaign code (find it in your campaign URL) | my-campaign |
Styling Attributes
| Attribute | Description | Default | Type |
|---|---|---|---|
label | Text displayed on the button | Donate | String |
label-color | Color of the text and icon | #FFFFFF | Hex Color Code |
background-color | Background color of the button | #FF8A00 | Hex Color Code |
border-color | Color of the button border | None | Hex Color Code |
border-width | Width of the border in pixels | 0 | Number |
border-radius | Corner roundness (higher = more rounded) | 100 | Number |
drop-shadow | Display a shadow beneath the button | true | Boolean |
Examples
Positioning
The button widget will display inline wherever you place the HTML tag. For common positioning scenarios:Best Practices
Button Label Text
Button Label Text
Color Contrast
Color Contrast
Ensure sufficient contrast between
label-color and background-color for accessibility: - Light
text on dark backgrounds - Dark text on light backgrounds - Test with WebAIM Contrast
CheckerMultiple Buttons
Multiple Buttons
Mobile Optimization
Mobile Optimization
The button automatically scales for mobile devices. For best results:
- Ensure adequate spacing around buttons
- Test on various screen sizes
- Avoid placing too many buttons in a row on mobile
Troubleshooting
Color not working? Hex codes must include the
# symbol (e.g., #FF8A00 not FF8A00).