Skip to main content
Version: Isle Royale (2.5.0)

CSS Customization

ToughClicks adds DOM elements with predefined CSS classes and IDs that you can use to customize the look and feel of the agreement interface to match your application's design.

Overview​

The ToughClicks library injects HTML into your specified container. All injected elements use CSS classes and IDs with the tc- prefix, making it easy to style them without conflicts with your existing styles.

You can customize:

  • Overall container appearance
  • Checkbox and label styles
  • Scrollable document containers
  • Modal dialog appearance
  • Helper text and instructions
  • Links and interactive elements

CSS Classes and IDs Reference​

Global Wrapper​

#tc-agreements​

The overall wrapper containing all ToughClicks elements.

Recommended use:

  • Set global typography (fonts, sizes, colors)
  • Set overall width and max-width
  • Configure link styles
  • Set default spacing and alignment

Example:

#tc-agreements {
margin: 0 auto;
max-width: 60%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333;
}

#tc-agreements a {
text-decoration: none;
color: #003EB3;
transition: color 0.2s;
}

#tc-agreements a:hover {
text-decoration: underline;
color: #3b65b3;
}

Checkbox Elements​

.tc-document-checkbox​

The container div that holds the checkbox input and its label.

Example:

.tc-document-checkbox {
padding: 12px 0;
margin: 8px 0;
}

.tc-document-checkbox label {
cursor: pointer;
font-weight: 500;
}

.tc-document-checkbox input[type="checkbox"] {
margin-right: 8px;
width: 18px;
height: 18px;
cursor: pointer;
}

Button Assent Display Method Styles​

When using displayMethod: 'buttonAssent', the SDK renders a notice and nothing else — no checkbox, no helper text. The default styles are deliberately minimal so the notice inherits your page's typography rather than imposing its own.

Because the enforceability of this mode depends on the notice being conspicuous, resist the temptation to shrink it or fade it out. Keep it at least as large and as legible as your page's body text.

.tc-assent-notice​

The wrapper element around the whole notice.

Example:

.tc-assent-notice {
margin: 0 0 12px 0;
text-align: center;
}

.tc-assent-notice-text​

The notice sentence itself. Style this to match the type around your submit button.

Example:

.tc-assent-notice-text {
font-family: inherit;
font-size: 14px;
line-height: 1.5;
color: #374151;
}

The document name links inside the notice. These keep the same open-in-modal or open-in-tab behavior as the other display methods.

Example:

.tc-assent-link {
color: #003EB3;
text-decoration: underline;
text-underline-offset: 2px;
}

.tc-assent-link:hover {
color: #3b65b3;
}

A worked example​

Placing the notice directly above a checkout button, sized to match the surrounding copy:

.tc-assent-notice {
max-width: 42ch;
margin: 0 auto 10px;
text-align: center;
}

.tc-assent-notice-text {
font-size: 13px;
line-height: 1.5;
color: #4b5563;
}

.tc-assent-link {
color: #1d4ed8;
font-weight: 500;
text-decoration: underline;
}

Note: the checkbox classes below are not rendered in this mode, so overrides targeting .tc-document-checkbox have no effect on a button assent packet.

Scroll Display Method Styles​

When using displayMethod: 'Scroll', these additional classes are used:

.tc-document-checkbox-force-scroll​

Additional class applied to .tc-document-checkbox when force scroll is enabled.

Example:

.tc-document-checkbox-force-scroll {
float: left;
margin-right: 12px;
}

.tc-document-scrollable​

The scrollable container that displays the document terms.

Recommended styling:

  • Set max-height and overflow-y: scroll
  • Add border and padding for readability
  • Style scrollbar (for webkit browsers)

Example:

.tc-document-scrollable {
max-height: 300px;
overflow-y: scroll;
border: 1px solid #ccc;
border-radius: 4px;
margin: 25px 0 0 0;
padding: 16px;
background-color: #fafafa;
}

/* Webkit scrollbar styling */
.tc-document-scrollable::-webkit-scrollbar {
width: 8px;
}

.tc-document-scrollable::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}

.tc-document-scrollable::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}

.tc-document-scrollable::-webkit-scrollbar-thumb:hover {
background: #555;
}

.tc-document-helper-text​

Helper text that instructs users to scroll to the bottom (e.g., "Scroll to the bottom of the document to accept").

Example:

.tc-document-helper-text {
float: right;
font-style: italic;
font-size: 12px;
color: #666;
margin-top: 4px;
}

When using shouldOpenModal: true, these classes style the modal dialog:

.tc-modal-container​

The modal overlay background.

Example:

.tc-modal-container {
display: none; /* Hidden by default */
position: fixed;
z-index: 1000;
padding: 10px 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
animation: fadeIn 0.3s;
}

@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}

.tc-modal-text​

The modal content wrapper (the white box).

Example:

.tc-modal-text {
background-color: #ffffff;
margin: 5% auto;
padding: 0 0 0 20px;
border: 1px solid #888;
border-radius: 8px;
width: 80%;
max-width: 800px;
max-height: 80vh;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
animation: slideIn 0.3s;
}

@keyframes slideIn {
from {
transform: translateY(-50px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}

.tc-modal-text-contents​

The scrollable content area within the modal.

Example:

.tc-modal-text-contents {
max-height: 70vh;
overflow-y: scroll;
padding: 20px;
font-size: 14px;
line-height: 1.6;
}

/* Webkit scrollbar styling */
.tc-modal-text-contents::-webkit-scrollbar {
width: 8px;
}

.tc-modal-text-contents::-webkit-scrollbar-track {
background: #f1f1f1;
}

.tc-modal-text-contents::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}

.tc-modal-text-close-bar​

The top bar of the modal where the close button is located.

Example:

.tc-modal-text-close-bar {
text-align: right;
padding: 10px 20px 10px 10px;
background-color: #f5f5f5;
border-bottom: 1px solid #ddd;
border-radius: 8px 8px 0 0;
position: sticky;
top: 0;
z-index: 10;
}

.tc-modal-close​

The close button (typically an "X").

Example:

.tc-modal-close {
color: #aaa;
font-size: 28px;
font-weight: bold;
cursor: pointer;
transition: color 0.2s;
user-select: none;
}

.tc-modal-close:hover,
.tc-modal-close:focus {
color: #000;
text-decoration: none;
}

Complete Starter CSS​

Here's a complete starting point for styling ToughClicks, based on the demo:

/* Global wrapper */
#tc-agreements {
margin: 0 auto;
max-width: 60%;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
font-size: 14px;
line-height: 1.6;
}

#tc-agreements a {
text-decoration: none;
color: #003EB3;
}

#tc-agreements a:hover {
text-decoration: underline;
color: #3b65b3;
}

/* Checkbox container */
.tc-document-checkbox {
margin: 12px 0;
padding: 8px 0;
}

/* Force scroll specific styles */
.tc-document-checkbox-force-scroll {
float: left;
}

.tc-document-helper-text {
float: right;
font-style: italic;
font-size: 12px;
color: #666;
}

/* Scrollable document container */
.tc-document-scrollable {
max-height: 300px;
overflow-y: scroll;
border: 1px solid #ccc;
border-radius: 4px;
margin: 25px 0 0 0;
padding: 10px;
background-color: #fafafa;
}

/* Modal styles */
.tc-modal-container {
display: none;
position: fixed;
z-index: 1000;
padding: 10px 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.5);
}

.tc-modal-text {
background-color: #fefefe;
margin: auto;
padding: 0 0 0 20px;
border: 1px solid #888;
border-radius: 8px;
width: 80%;
max-width: 800px;
max-height: 80vh;
}

.tc-modal-text-contents {
max-height: 75vh;
overflow-y: scroll;
padding: 20px;
}

.tc-modal-text-close-bar {
text-align: right;
padding-right: 10px;
height: 40px;
line-height: 40px;
background-color: #f5f5f5;
border-radius: 8px 8px 0 0;
}

.tc-modal-close {
color: #aaaaaa;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}

.tc-modal-close:hover,
.tc-modal-close:focus {
color: #000;
text-decoration: none;
}

Responsive Design​

Make ToughClicks responsive for mobile devices:

/* Desktop */
#tc-agreements {
max-width: 60%;
margin: 0 auto;
}

/* Tablet */
@media (max-width: 1024px) {
#tc-agreements {
max-width: 80%;
}

.tc-modal-text {
width: 90%;
}
}

/* Mobile */
@media (max-width: 768px) {
#tc-agreements {
max-width: 95%;
font-size: 13px;
}

.tc-document-scrollable {
max-height: 200px;
}

.tc-modal-text {
width: 95%;
margin: 10% auto;
}

.tc-modal-text-contents {
max-height: 60vh;
}
}

Dark Mode Support​

Add dark mode styling:

@media (prefers-color-scheme: dark) {
#tc-agreements {
color: #e0e0e0;
}

#tc-agreements a {
color: #5c9fff;
}

#tc-agreements a:hover {
color: #89b4ff;
}

.tc-document-scrollable {
background-color: #2a2a2a;
border-color: #444;
color: #e0e0e0;
}

.tc-modal-text {
background-color: #1e1e1e;
border-color: #444;
color: #e0e0e0;
}

.tc-modal-text-close-bar {
background-color: #2a2a2a;
border-bottom-color: #444;
}

.tc-modal-close {
color: #888;
}

.tc-modal-close:hover {
color: #fff;
}
}

Custom Checkbox Styling​

Create custom checkbox styles:

.tc-document-checkbox input[type="checkbox"] {
/* Hide default checkbox */
appearance: none;
-webkit-appearance: none;
width: 20px;
height: 20px;
border: 2px solid #003EB3;
border-radius: 4px;
cursor: pointer;
position: relative;
margin-right: 10px;
transition: all 0.2s;
}

.tc-document-checkbox input[type="checkbox"]:checked {
background-color: #003EB3;
}

.tc-document-checkbox input[type="checkbox"]:checked::after {
content: '✓';
position: absolute;
color: white;
font-size: 14px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.tc-document-checkbox input[type="checkbox"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}

Accessibility Enhancements​

Improve accessibility with focus states and high contrast:

/* Focus states */
.tc-document-checkbox input[type="checkbox"]:focus {
outline: 2px solid #003EB3;
outline-offset: 2px;
}

#tc-agreements a:focus {
outline: 2px solid #003EB3;
outline-offset: 2px;
border-radius: 2px;
}

.tc-modal-close:focus {
outline: 2px solid #003EB3;
outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
.tc-document-scrollable {
border: 2px solid #000;
}

.tc-document-checkbox input[type="checkbox"] {
border: 2px solid #000;
}
}

Framework-Specific Integration​

Tailwind CSS​

If using Tailwind, you can add utility classes via JavaScript or use @apply:

#tc-agreements {
@apply max-w-2xl mx-auto font-sans text-sm;
}

#tc-agreements a {
@apply text-blue-600 hover:text-blue-800 hover:underline;
}

.tc-document-scrollable {
@apply max-h-80 overflow-y-auto border border-gray-300 rounded p-4 bg-gray-50;
}

Bootstrap​

ToughClicks works alongside Bootstrap classes:

#tc-agreements {
/* Let Bootstrap handle base styles */
}

.tc-document-scrollable {
max-height: 300px;
overflow-y: scroll;
/* Bootstrap utilities work here */
@extend .border;
@extend .rounded;
@extend .p-3;
@extend .bg-light;
}

Best Practices​

  1. Maintain specificity: Use the #tc-agreements prefix to avoid style conflicts
  2. Test all display methods: Ensure your styles work with Scroll, Individual, and Group methods
  3. Consider mobile: Make sure styles are responsive
  4. Test modal: If using shouldOpenModal: true, test modal styles thoroughly
  5. Accessibility: Include focus states and sufficient color contrast
  6. Scrollbar styling: Consider cross-browser scrollbar appearance
  7. Animation: Add subtle transitions for better UX

Troubleshooting​

Styles not applying​

  • Check CSS selector specificity
  • Ensure CSS is loaded after ToughClicks renders
  • Verify class names (they all start with tc-)
  • Check browser console for CSS errors
  • Check z-index values (should be high, e.g., 1000+)
  • Verify .tc-modal-container display property
  • Check for conflicting modal libraries

Scrollable area not scrolling​

  • Ensure max-height is set on .tc-document-scrollable
  • Verify overflow-y: scroll is applied
  • Check for parent container constraints