B2Lib provides extensive configuration options to customize the appearance, behavior, and functionality of all UI components. This guide covers every aspect of the configuration system, from basic settings to advanced customization.
Overview
The B2Lib configuration system is centralized in the Config.lua file, which contains all settings for:
Theme System - Colors, typography, spacing, and visual styles
-- Notification in top-right corner
exports.b2lib:notify({
message = "Welcome to the server!",
position = "top-right"
})
-- Progress bar in center
exports.b2lib:progress({
label = "Loading...",
position = "center",
duration = 5000
})
-- Text UI at bottom center
exports.b2lib:textUI({
text = "[E] Interact",
position = "bottom-center"
})
text = {
primary = '#f9fafb', -- Headings, important text
secondary = '#e5e7eb', -- Body text
tertiary = '#9ca3af', -- Muted text, labels
inverse = '#111827' -- Dark text for light backgrounds
}
Config.Progress = {
position = 'center', -- Default position for progress bars
showPercentage = true, -- Display percentage text
defaultColor = 'primary', -- Default progress bar color
defaultType = 'circular' -- Default type: 'circular' or 'linear'
}
exports.b2lib:progress({
label = 'Processing...',
duration = 5000,
type = 'circular',
color = 'success'
})
Config.TextUI = {
position = 'bottom-center', -- Default position for text UI
showBackground = true, -- Show background for better readability
fadeTime = 400 -- Fade animation duration in milliseconds
}
exports.b2lib:textUI({
text = 'Press E to interact',
keybind = 'E',
icon = 'hand'
})
Config.Menu = {
position = 'center-left', -- Default position for menus
width = 400, -- Default menu width in pixels
enableSearch = true, -- Enable search functionality
closeOnClick = true, -- Close menu when clicking outside
maxItems = 10 -- Maximum items per menu page
}
Config.Input = {
position = 'center', -- Default position for input dialogs
showBackground = true, -- Show dialog background
enableValidation = true -- Enable input validation
}
Config.Alert = {
position = 'center-left', -- Default position for alert dialogs
showBackground = true, -- Show dialog background
enableConfirm = true -- Enable confirmation dialogs
}
Config.ContextMenu = {
enableTouch = true, -- Enable touch/mobile support
closeOnOutsideClick = true, -- Close when clicking outside menu
showIcons = true -- Show icons in menu items
}
Config.Skillcheck = {
position = 'center', -- Default position for skillcheck
defaultDifficulty = 'medium', -- Default difficulty level
difficulties = {
easy = {
speed = 1.0, -- Slow indicator movement
targetSize = 45, -- Target zone size (not used in single-zone)
perfectSize = 25, -- Large perfect zone
maxAttempts = 5, -- Multiple attempts
pattern = 'continuous', -- Movement pattern
direction = 1 -- Clockwise movement
},
medium = {
speed = 2.0, -- Medium indicator movement
targetSize = 45, -- Target zone size (not used in single-zone)
perfectSize = 15, -- Medium perfect zone
maxAttempts = 3, -- Three attempts
pattern = 'continuous', -- Movement pattern
direction = 1 -- Clockwise movement
},
hard = {
speed = 3.0, -- Fast indicator movement
targetSize = 45, -- Target zone size (not used in single-zone)
perfectSize = 10, -- Small perfect zone
maxAttempts = 2, -- Two attempts
pattern = 'bounce', -- Bounce pattern for difficulty
direction = 1 -- Clockwise movement
},
expert = {
speed = 4.0, -- Very fast indicator movement
targetSize = 45, -- Target zone size (not used in single-zone)
perfectSize = 8, -- Tiny perfect zone
maxAttempts = 1, -- Single attempt only
pattern = 'bounce', -- Bounce pattern
direction = -1 -- Counter-clockwise for confusion
}
}
}
Config.ComponentStyles.lockpicking = {
-- Container settings
width = '300px', -- Interface width
padding = '20px', -- Internal padding
borderRadius = '16px', -- Corner rounding
shadow = 'xl', -- Drop shadow
-- Lock mechanism styling
lockSize = '192px', -- Lock circle size
outerRingWidth = '4px', -- Outer ring thickness
innerRingWidth = '2px', -- Inner ring thickness
handleWidth = '4px', -- Handle arm thickness
handleLength = '64px', -- Handle arm length
centerSize = '24px', -- Center hub size
-- Sweet spot indicator
sweetSpotWidth = '3px', -- Sweet spot indicator width
sweetSpotLength = '20px', -- Sweet spot indicator length
sweetSpotGlow = '8px', -- Glow effect size
-- Feedback system
feedbackBarWidth = '12px', -- Feedback bar width
feedbackBarHeight = '48px', -- Feedback bar height
feedbackBarSpacing = '2px', -- Spacing between bars
-- Time remaining bar
timeBarWidth = '200px', -- Time bar width
timeBarHeight = '8px', -- Time bar height
timeBarRadius = 'full', -- Time bar corner rounding
-- Animation settings
transitionDuration = 300, -- Transition duration in ms
glowTransition = 'ease-out', -- Glow animation easing
pulseIntensity = 0.2 -- Pulse effect intensity
}
Config.RadialMenu = {
-- Keybind settings
keybind = 20, -- Control ID for Z key
holdToActivate = true, -- Hold key to show, release to hide
-- Visual settings
defaultRadius = 100, -- Distance from center to items
minRadius = 80, -- Minimum radius for small menus
maxRadius = 150, -- Maximum radius for large menus
centerSize = 50, -- Size of center circle
itemSize = 45, -- Size of individual items
-- Dynamic expansion
enableDynamicRadius = true, -- Expand radius based on item count
radiusPerItem = 6, -- Additional radius per item beyond 6 items
animationDuration = 250, -- Animation duration in milliseconds
expansionDelay = 40, -- Delay between item appearances
-- Interaction settings
selectionDeadzone = 30, -- Minimum distance from center to select
autoSelectOnHover = false, -- Auto-select items on hover
hapticFeedback = true, -- Enable controller vibration
allowMovementDuringMenu = true, -- Allow player movement while menu is open
-- Visual styles
defaultStyle = 'default', -- Style preset: 'default', 'minimal', 'gaming'
showLabels = true, -- Show item labels
showCenter = true, -- Show center circle
showConnectors = false, -- Show lines connecting items to center
}
Config.RadialMenu.mainMenu = {
id = 'main',
title = 'Main Menu',
centerIcon = 'β',
items = {
{
id = 'citizen',
title = 'Citizen',
icon = 'π€',
items = {
{
id = 'givecontact',
title = 'Give Contact',
icon = 'π',
type = 'client',
event = 'b2lib:contact:give',
shouldClose = true
},
-- More items...
}
},
-- More categories...
}
}
Config.Performance = {
maxNotifications = 5, -- Maximum simultaneous notifications
updateInterval = 16, -- UI update interval in milliseconds (60 FPS)
fadeAnimations = true, -- Enable fade in/out animations
maxCacheSize = 1000, -- Maximum cached UI elements
raycastDistance = 10.0, -- Maximum distance for interaction raycasting
entityCheckDistance = 50.0 -- Maximum distance for entity detection
}