### Garry's Mod Lua: Quick Start with libNyx UI Components Source: https://github.com/maryblackfild/libnyx/blob/main/README.md This snippet demonstrates how to quickly initialize and use libNyx UI components in Garry's Mod. It shows the creation of a basic frame and a button with an onClick event. The example also includes a call to open the libNyx UI showcase. ```lua -- Create a frameless “glass” window local W, H = 960, 640 local frame = libNyx.UI.CreateFrame({ w = W, h = H, title = "libNyx UI" }) -- Add a button local btn = libNyx.UI.Components.CreateButton(frame, "Click me", { variant = "primary", onClick = function() chat.AddText(Color(0,255,0), "[libNyx] Hello!") end }) btn:Dock(TOP); btn:DockMargin(16,16,16,0) -- Show the demo window (or just run the console command) libNyx.UI.OpenShowcase() ``` -------------------------------- ### Garry's Mod Lua: libNyx UI Installation and Update Check Source: https://github.com/maryblackfild/libnyx/blob/main/README.md This snippet illustrates the expected console output during the installation and update check process for libNyx UI in Garry's Mod. It shows messages for successful loading, version checking, and notifications for available updates. ```lua -- Successful installation and up-to-date [libNyx] Loaded vX.Y.Z (server|client) [libNyx] Checking for updates… [libNyx] Up-to-date ✓ (latest: X.Y.Z) -- Update available notification [libNyx] Update available ✱ installed X.Y.Z → latest A.B.C [libNyx] Get it: https://github.com/maryblackfild/libnyx ``` -------------------------------- ### Open libNyx UI Showcase (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt Opens the interactive UI showcase for libNyx, demonstrating all components with example configurations and interactive elements. This can be done either programmatically via a function call or through a console command. ```lua -- Open showcase via console command -- libnyx_ui_showcase -- Open showcase programmatically libNyx.UI.OpenShowcase() -- The showcase includes two demo pages: -- Page 1: Buttons, checkboxes, slider, dropdown, list, cells -- Page 2: Tabs, search, category cards in flow layout -- Features demonstrated: -- - All component variants -- - Layout examples (docking, margins) -- - Interactive drag-and-drop cells -- - Searchable card grid -- - Tab navigation -- - Glass panel styling -- - Smooth scrolling lists -- - Ripple effects -- - Hover states -- - Sound effects -- The showcase is a complete reference implementation -- showing best practices for libNyx UI usage ``` -------------------------------- ### Create Animated Glass Frame in libNyx (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt This code example illustrates how to create a glass-style UI frame with smooth opening and closing animations using the libNyx library. The frames feature automatic centering, blur effects, and an integrated close button. It also shows how to add content to the frame and programmatically close it, along with an example of creating multiple independent frames. ```lua -- Create a basic frame local frame = libNyx.UI.CreateFrame({ w = 960, h = 640, title = "My Custom Window" }) -- Frame opens automatically with easeOutBack animation -- Content alpha fades in during opening animation -- Close button is automatically positioned in top-right -- Close the frame programmatically frame:Close() -- Triggers smooth closing animation -- Add content to the frame local panel = vgui.Create("DPanel", frame) panel:Dock(FILL) panel:DockMargin(libNyx.UI.Scale(16), libNyx.UI.Scale(16), libNyx.UI.Scale(16), libNyx.UI.Scale(16)) p panel.Paint = nil -- Frame features: -- - Animated opening (0.22s with overshoot) -- - Animated closing (0.18s with ease-in) -- - Content alpha gating (children fade in during animation) -- - Glass background with blur -- - Automatic centering on screen -- - Integrated close button -- Advanced: Multiple frames local frame1 = libNyx.UI.CreateFrame({w = 800, h = 600, title = "Window 1"}) local frame2 = libNyx.UI.CreateFrame({w = 600, h = 400, title = "Window 2"}) -- Both animate independently ``` -------------------------------- ### Create Search Box with Debouncing and Language Detection Source: https://context7.com/maryblackfild/libnyx/llms.txt Demonstrates how to create a search input component using libNyx.UI.Components.CreateSearchBox. It supports features like placeholder text, debouncing for onChange events, custom callbacks for search submission and clearing, and programmatic text manipulation. The component includes automatic RU/EN language detection, a clear button, focus animations, and gradient accents. The example shows basic usage and a real-world filtering scenario. ```lua -- Basic search box local search = libNyx.UI.Components.CreateSearchBox(parent, { placeholder = "Search items…", tint = Color(90, 160, 255), debounce = 0.15, -- Delay before onChange fires (seconds) onChange = function(query) print("Searching for:", query) -- Filter your data based on query filterResults(query) end, onSubmit = function(query) print("Search submitted:", query) -- Handle Enter key press end, onClear = function() print("Search cleared") -- Reset filtered results showAllResults() end }) search:Dock(TOP) search:SetTall(libNyx.UI.Scale(38)) search:DockMargin(16, 16, 16, 0) -- Real-world example: filtering a list local items = {"Apple", "Banana", "Cherry", "Date", "Elderberry"} local searchBox = libNyx.UI.Components.CreateSearchBox(toolbar, { placeholder = "Filter…", tint = libNyx.UI.Style.accentColor, onChange = function(query) query = string.lower(query) for _, item in ipairs(items) do local visible = query == "" or string.find(string.lower(item), query, 1, true) -- Show/hide items based on visibility end end, onClear = function() -- Show all items end }) -- Programmatic access local currentText = search:GetText() search:SetText("new search term") search:Focus() -- Give focus to the search box -- Features: -- - Debounced onChange (prevents too many calls) -- - Automatic RU/EN language detection and indicator -- - Clear button (X icon) when text present -- - Focus glow animation -- - Gradient accent that expands on focus -- - Glass background with blur -- - Search icon on left ``` -------------------------------- ### Create Buttons with Variants and Effects (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt This snippet demonstrates how to create buttons with multiple style variants (primary, soft, ghost, gradient, centered) and includes examples of adding icons and custom click handlers. The buttons support various visual styles and effects like ripple effects. ```lua -- Basic primary button local btnPrimary = libNyx.UI.Components.CreateButton(parent, "Click Me", { variant = "primary", onClick = function(btn) chat.AddText(Color(0,255,0), "[libNyx] Button clicked!") end }) btnPrimary:Dock(TOP) btnPrimary:DockMargin(16, 16, 16, 0) -- Gradient button with custom tint local btnGradient = libNyx.UI.Components.CreateButton(parent, "Special Action", { variant = "gradient", align = "left", tint = Color(255, 125, 155), icon = Material("icon16/star.png"), onClick = function() print("Gradient button clicked") end }) gtnGradient:Dock(TOP) -- Ghost button (transparent until hover) local btnGhost = libNyx.UI.Components.CreateButton(parent, "Cancel", { variant = "ghost", onClick = function(btn) if IsValid(frame) then frame:Close() end end }) btnGhost:Dock(BOTTOM) -- Center duo variant (dual gradient) local btnDuo = libNyx.UI.Components.CreateButton(parent, "Premium", { variant = "center_duo", tint = Color(97, 17, 191), centerTint = Color(136, 49, 238) }) -- Variants available: -- "primary" - solid accent color -- "soft" - softer panel color -- "ghost" - transparent with hover -- "gradient" - left-to-right gradient -- "primary_center" - centered text -- "center_duo" - dual gradient from center ``` -------------------------------- ### Enhance DScrollPanel with Smooth Scrolling (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt Applies smooth momentum scrolling and a styled scrollbar with fade effects to existing DScrollPanel instances. Configuration options include scroll step, speed, fade hold time, and scrollbar width. It can also be installed as an alternative method or automatically applied when using the CreateList component. ```lua -- Apply to existing DScrollPanel local scrollPanel = vgui.Create("DScrollPanel", parent) scrollPanel:Dock(FILL) libNyx.UI.SmoothScroll.ApplyToScrollPanel(scrollPanel, { step = libNyx.UI.Scale(90), -- Scroll step per wheel tick speed = 18, -- Interpolation speed fadeHold = 0.9, -- Time before scrollbar fades (seconds) width = libNyx.UI.Scale(12) -- Scrollbar width }) -- Alternative installation method libNyx.UI.SmoothScroll.InstallUnder(scrollPanel, { step = 100, speed = 20 }) -- The CreateList component automatically includes smooth scrolling: local list = libNyx.UI.Components.CreateList(parent, { rowHeight = libNyx.UI.Scale(82), vbarWidth = libNyx.UI.Scale(12) -- Scrollbar width }) -- Features: -- - Smooth momentum scrolling -- - Interpolated scroll position -- - Auto-fading scrollbar -- - Glass-style scrollbar knob -- - Configurable scroll step and speed -- - Automatic installation on CreateList -- Manual scroll control scrollPanel:GetVBar():SetScroll(100) -- Jump to position scrollPanel:GetVBar():AnimateTo(500, 0.5, 0, 0.5) -- Smooth scroll to position ``` -------------------------------- ### Garry's Mod Lua: Running the libNyx UI Showcase Source: https://github.com/maryblackfild/libnyx/blob/main/README.md This is a command-line instruction to launch the interactive showcase for libNyx UI components within Garry's Mod. The showcase allows users to explore various components, layouts, and states provided by the library. ```bash libnyx_ui_showcase ``` -------------------------------- ### Project Directory Structure (Tree) Source: https://github.com/maryblackfild/libnyx/blob/main/README.md Illustrates the file and directory organization of the libnyx project. This structure helps in understanding the placement of core files, utility modules, and the main demo script. ```tree libnyx/ ├─ VERSION └─ lua/ ├─ autorun/ │ └─ libnyx.lua └─ libnyx/lib/ ├─ rndx.lua ├─ libnyx_components.lua └─ libnyx_maindemo.lua ``` -------------------------------- ### Initialize libNyx and Manage Versions (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt This snippet demonstrates how to initialize the libNyx UI library and its automatic version checking capabilities. The library handles loading on both client and server, compares local versions with GitHub releases, and provides console notifications for updates. It also shows how to access the library version programmatically. ```lua -- The autorun loader at lua/autorun/libnyx.lua handles initialization -- It automatically loads on both client and server and prints version info -- Console output on load: -- [libNyx] Loaded v0.6.3 (client) -- [libNyx] Checking for updates… -- [libNyx] Up-to-date ✓ (latest: 0.6.3) -- If an update is available: -- [libNyx] Update available ✱ installed 0.6.3 → latest 0.7.0 -- [libNyx] Get it: https://github.com/maryblackfild/libnyx -- Access version programmatically print(libNyx.Version) -- "0.6.3" -- The library automatically: -- 1. Reads VERSION file from multiple possible locations -- 2. Fetches remote VERSION from GitHub -- 3. Compares and notifies in console -- 4. Falls back to parsing loader file if primary check fails ``` -------------------------------- ### Create VBox Containers with Variants (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt Demonstrates the creation of VBox containers with different visual variants like center_gradient, sunburst, and model displays. These containers support features such as glass panel bases, hover animations, title displays, and customizable tint colors. ```lua -- Center gradient variant local box1 = libNyx.UI.Components.CreateVBox(parent, { variant = "center_gradient", title = "Featured Item", icon = Material("icon16/heart.png"), tint = Color(140, 120, 255) }) box1:Dock(LEFT) box1:DockMargin(0, 0, 16, 0) box1:SetSize(libNyx.UI.Scale(180), libNyx.UI.Scale(220)) -- Sunburst variant (animated rays) local box2 = libNyx.UI.Components.CreateVBox(parent, { variant = "sunburst", title = "Special", icon = Material("icon16/star.png"), tint = Color(255, 180, 90) }) box2:Dock(LEFT) box2:SetSize(libNyx.UI.Scale(180), libNyx.UI.Scale(220)) -- Model variant (3D model display) local box3 = libNyx.UI.Components.CreateVBox(parent, { variant = "model", title = "Oil Drum", model = "models/props_c17/oildrum001.mdl", tint = Color(120, 200, 255) }) box3:Dock(LEFT) -- Vertical gradient variant local box4 = libNyx.UI.Components.CreateVBox(parent, { variant = "vertical_gradient", title = "Category", icon = Material("icon16/flag_yellow.png"), tint = Color(120, 180, 255) }) -- Variants: -- "center_gradient" - gradient from center with icon -- "vertical_gradient" - bottom-to-top gradient -- "sunburst" - animated rotating rays -- "model" - 3D model with automatic camera fitting -- Features: -- - Glass panel base -- - Hover animations (pulse, scale) -- - Title display at bottom -- - Icon or model display -- - Custom tint colors per box ``` -------------------------------- ### Create Tabs Component with libnyx Source: https://context7.com/maryblackfild/libnyx/llms.txt This Lua code demonstrates how to create a tab navigation component using libnyx. It supports dynamic item setting, programmatic tab changes, and includes features like animated selection indicators, hover effects, and icon support. The `onChange` callback allows for custom logic when a tab is selected. ```lua local tabs = libNyx.UI.Components.CreateTabs(parent, { items = { {id = "home", label = "Home", icon = Material("icon16/house.png")}, {id = "settings", label = "Settings", icon = Material("icon16/cog.png")}, {id = "profile", label = "Profile", icon = Material("icon16/user.png")}, {id = "help", label = "Help", icon = Material("icon16/help.png")} }, default = "home", -- Initially selected tab onChange = function(id, btn) print("Tab changed to:", id) -- Show/hide content based on selected tab if id == "home" then homePanel:SetVisible(true) settingsPanel:SetVisible(false) elseif id == "settings" then homePanel:SetVisible(false) settingsPanel:SetVisible(true) end end }) tabs:Dock(TOP) tabs:SetTall(libNyx.UI.Scale(52)) tabs:DockMargin(16, 16, 16, 8) -- Programmatically change active tab tabs:SetActive("settings") -- Switches to settings tab with animation -- Dynamic tabs (change items at runtime) tabs:SetItems({ {id = "tab1", label = "New Tab 1"}, {id = "tab2", label = "New Tab 2"} }) ``` -------------------------------- ### Configure Global UI Style and Adaptive Scaling Source: https://context7.com/maryblackfild/libnyx/llms.txt Shows how to customize the global UI style and enable adaptive scaling for all libnyx components. The Style table allows modification of colors (backgrounds, accents, text, glass effects) and metrics (radius, padding, sizes). It also demonstrates the use of libNyx.UI.Scale for screen-adapted values and how to control scaling behavior via ConVars or use scaled fonts. ```lua -- Access global style local Style = libNyx.UI.Style -- Color customization Style.bgColor = Color(10, 10, 14, 150) -- Frame background Style.panelColor = Color(16, 18, 24, 120) -- Panel background Style.cardColor = Color(20, 22, 30, 130) -- Card background Style.accentColor = Color(90, 160, 255) -- Accent color (buttons, etc) Style.textColor = Color(245, 245, 250) -- Text color Style.glassFill = Color(20, 24, 32, 110) -- Glass fill color Style.glassStroke = Color(255, 255, 255, 22) -- Glass stroke color -- Metric customization (auto-scaled) Style.radius = 12 -- Border radius Style.padding = 14 -- Standard padding Style.iconSize = 24 -- Icon size Style.btnHeight = 44 -- Button height Style.rowHeight = 82 -- List row height -- Scale helper (converts to scaled pixels) local scaledValue = libNyx.UI.Scale(100) -- Returns screen-adapted size print(scaledValue) -- e.g., 110 on larger screen, 90 on smaller -- Manual scale override (ConVar) -- cl_libnyx_ui_scale 0 -- Auto scale (default) -- cl_libnyx_ui_scale 1.5 -- 150% scale -- cl_libnyx_ui_scale 0.75 -- 75% scale -- Valid range: 0 (auto) or 0.50 to 2.00 -- Font access (auto-scaled) local font = libNyx.UI.Font(20) -- Returns scaled font name surface.SetFont(font) -- Features: -- - Automatic scale based on 1080p baseline -- - Manual override via ConVar -- - Consistent scaling across all components -- - Font cache for sizes 10-200 -- - Fallback to Tahoma if Manrope unavailable ``` -------------------------------- ### Create Category Cards with Variants (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt Illustrates the creation of Category Cards, supporting 'vibrant' and 'glass' styling options. These cards feature dual gradient backgrounds, icons/images, titles, descriptions, and animated hover effects with ripples. ```lua -- Vibrant variant card local cardVibrant = libNyx.UI.Components.CreateCategoryCard(parent, { variant = "vibrant", title = "Nyx Team", desc = "Professional development team creating quality addons.", from = Color(129, 82, 255), -- Gradient start to = Color(40, 192, 255), -- Gradient end icon = "path/to/icon.png" -- Material path }) cardVibrant:SetSize(libNyx.UI.Scale(280), libNyx.UI.Scale(120)) -- Glass variant card local cardGlass = libNyx.UI.Components.CreateCategoryCard(parent, { variant = "glass", title = "Premium Content", desc = "Exclusive items and features for premium members.", from = Color(72, 210, 150), to = Color(28, 190, 140), onClick = function() print("Card clicked!") end }) cardGlass:SetSize(libNyx.UI.Scale(280), libNyx.UI.Scale(120)) -- Use in flow layout for grid local flow = vgui.Create("DIconLayout", parent) flow:Dock(FILL) flow:SetSpaceX(16) flow:SetSpaceY(16) -- Add multiple cards to flow for i = 1, 6 do local card = libNyx.UI.Components.CreateCategoryCard(flow, { variant = (i % 2 == 0) and "vibrant" or "glass", title = "Category " .. i, desc = "Description for category " .. i, from = Color(math.random(50, 255), math.random(50, 255), math.random(50, 255)), to = Color(math.random(50, 255), math.random(50, 255), math.random(50, 255)) }) card:SetSize(libNyx.UI.Scale(220), libNyx.UI.Scale(120)) end -- Features: -- - Dual gradient backgrounds (vibrant or glass) -- - Hover scale animation -- - Ripple effects on click -- - Title and description text -- - Animated dash indicator -- - Icon/image support ``` -------------------------------- ### Create Animated Value Sliders (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt This code snippet illustrates the creation of sliders with animated value display and counter bubbles. It supports defining minimum and maximum values, decimal precision, and custom tints, offering smooth value interpolation and visual feedback during interaction. ```lua -- Basic slider local slider = libNyx.UI.Components.CreateSlider(parent, { min = 0, max = 100, value = 50, decimals = 0, tint = Color(90, 160, 255) }) slider:Dock(TOP) slider:SetTall(libNyx.UI.Scale(30)) slider:DockMargin(16, 16, 16, 0) -- Get current value local currentValue = slider:GetValue() print("Slider value:", currentValue) -- Slider with decimals (volume control) local volumeSlider = libNyx.UI.Components.CreateSlider(parent, { min = 0, max = 1, value = 0.75, decimals = 2, tint = Color(120, 220, 160) }) volumeSlider:Dock(TOP) -- Features: -- - Smooth value interpolation (animated counter) -- - Hover and drag visual feedback (knob emphasis) -- - Dynamic counter bubble width (expands with number size) -- - Pulse animation on value change -- - Glass-style track with gradient fill -- Access the raw DNumSlider methods slider:SetValue(75) -- Set programmatically slider:SetMin(10) slider:SetMax(200) ``` -------------------------------- ### Create Checkbox, Switch, and Radio Components (Lua) Source: https://context7.com/maryblackfild/libnyx/llms.txt This section shows how to create toggleable UI controls including switches, knobs, and radio buttons. It covers different visual variants and demonstrates group management for radio buttons, ensuring only one can be selected at a time. ```lua -- Switch variant (iOS-style toggle) local switch = libNyx.UI.Components.CreateCheckbox(parent, { variant = "switch", label = "Enable Feature", checked = true, tint = libNyx.UI.Style.accentColor, onChange = function(checked) chat.AddText(Color(255,255,0), "Switch: ", checked and "ON" or "OFF") end }) switch:Dock(TOP) -- Knob variant (circular toggle) local knob = libNyx.UI.Components.CreateCheckbox(parent, { variant = "knob", label = "Dark Mode", checked = false, tint = Color(120, 180, 255), onChange = function(checked) print("Knob toggled:", checked) end }) knob:Dock(TOP) -- Radio button (auto-grouped by parent) local radio1 = libNyx.UI.Components.CreateCheckbox(parent, { variant = "radio", label = "Option A", checked = true, group = "mygroup" -- optional explicit group }) local radio2 = libNyx.UI.Components.CreateCheckbox(parent, { variant = "radio", label = "Option B", checked = false, group = "mygroup" }) -- Only one radio in a group can be checked at a time radio1:Dock(LEFT) radio2:Dock(LEFT) -- Programmatic control switch:SetChecked(false) -- Toggle the switch if switch:GetChecked() then print("Switch is on") end ``` -------------------------------- ### Create Dropdown Component with Lua Source: https://context7.com/maryblackfild/libnyx/llms.txt Generates a dropdown menu component with customizable options, placeholders, and selection callbacks. Supports icons for choices and features a glass-style panel with animated reveals. The `onSelect` callback is triggered when an option is chosen. ```lua -- Basic dropdown local dropdown = libNyx.UI.Components.CreateDropdown(parent, { placeholder = "Select an option...", choices = {"Option A", "Option B", "Option C", "Option D"}, tint = Color(90, 160, 255), onSelect = function(value) chat.AddText(Color(0,255,0), "[libNyx] Selected: ", Color(255,255,0), value) end }) dropdown:Dock(TOP) dropdown:SetTall(libNyx.UI.Scale(36)) dropdown:DockMargin(16, 0, 16, 16) -- Dropdown with icons local categoryDD = libNyx.UI.Components.CreateDropdown(parent, { placeholder = "Choose category...", choices = { {text = "Real Estate", icon = Material("icon16/house.png")}, {text = "Business", icon = Material("icon16/briefcase.png")}, {text = "Premium", icon = Material("icon16/star.png")}, {text = "VIP Access", icon = Material("icon16/key.png")} }, tint = Color(170, 120, 255), onSelect = function(value) print("Category selected:", value) end }) categoryDD:Dock(TOP) -- Features: -- - Glass panel with blur effect -- - Animated menu reveal/hide -- - Icon support for each option -- - Ripple effect on selection -- - Gradient accent based on tint -- - Automatic positioning (opens downward) -- Get current selection local selected = dropdown:GetSelected() -- Returns selected text or nil ``` -------------------------------- ### Configure UI Sound Effects and Ripple Animations Source: https://context7.com/maryblackfild/libnyx/llms.txt Details how to manage UI sound effects and ripple animations within libnyx. It covers playing default hover and click sounds, customizing their file paths, and setting the style for ripple effects (fill or ring). The library also automatically redirects standard Garry's Mod UI sound events. ```lua -- Play sounds manually libNyx.UI.PlayHover() -- Plays hover sound libNyx.UI.PlayClick() -- Plays click sound -- Customize sound paths libNyx.UI.Sounds.hover = "path/to/hover.wav" libNyx.UI.Sounds.click = "path/to/click.wav" -- Ripple styles libNyx.UI.SetRippleStyle("fill") -- Solid circle fill (default) libNyx.UI.SetRippleStyle("ring") -- Ring/outline only libNyx.UI.SetRippleStyle(1) -- Fill variant libNyx.UI.SetRippleStyle(2) -- Ring variant -- Check current ripple style local currentStyle = libNyx.UI.GetRippleStyle() -- Returns 1 or 2 -- The library automatically redirects default GMod sounds: -- "buttons/lightswitch2.wav" → hover sound -- "ui/buttonclick.wav" → click sound -- "ui/buttonclickrelease.wav" → click sound -- Features: -- - Global sound redirection -- - Per-button ripple style override -- - Two ripple animation variants -- - Automatic sound playback on hover/click ``` -------------------------------- ### Create Interactive Inventory Cells with libnyx Source: https://context7.com/maryblackfild/libnyx/llms.txt This Lua code illustrates the creation of interactive inventory cells using libnyx. These cells support drag-and-drop functionality, display item icons or 3D models, and feature hover-activated info boxes with detailed descriptions and tags. It also shows how to check if a cell contains an item and how to clear it. ```lua -- Create two interactive cells local cellA = libNyx.UI.Components.CreateInteractiveCell(parent, { size = libNyx.UI.Scale(88), tint = Color(140, 120, 255) }) cellA:Dock(LEFT) cellA:DockMargin(0, 0, 16, 0) local cellB = libNyx.UI.Components.CreateInteractiveCell(parent, { size = libNyx.UI.Scale(88), tint = Color(120, 200, 255) }) bellB:Dock(LEFT) -- Set item with info box cellA:SetItemIcon( Material("icon16/package.png", "noclamp smooth"), libNyx.UI.Scale(40), { title = "Epic Loot Box", desc = "Contains rare items and exclusive rewards. Open to receive random items based on rarity tiers.", tags = { {text = "Epic", color = Color(170, 120, 255)}, {text = "Tradeable", color = Color(120, 220, 160)}, {text = "Limited", color = Color(255, 125, 155)} } } ) -- Set 3D model instead of icon cellB:SetItemModel("models/props_c17/oildrum001.mdl") -- Check if cell has item if cellA:HasItem() then print("Cell A has an item") end -- Clear item cellA:ClearItem() -- Get cell center screen position (useful for particle effects) local x, y = cellA:GetCenterScreen() ``` -------------------------------- ### Create List Component with Lua Source: https://context7.com/maryblackfild/libnyx/llms.txt Constructs a scrollable list component with support for row icons, labels, right-aligned text, and gradient backgrounds. Each row can have custom click handlers and features ripple effects. The `AddRow` method allows for detailed customization of list items. ```lua -- Create a list container local list = libNyx.UI.Components.CreateList(parent, { rowHeight = libNyx.UI.Style.rowHeight, vbarWidth = libNyx.UI.Scale(12) }) list:Dock(FILL) list:DockMargin(16, 16, 16, 16) -- Add rows with all features list:AddRow({ title = "Premium Item Pack", icon = Material("icon16/cart.png"), labels = { {text = "Premium", color = Color(255, 215, 0)}, {text = "New", color = Color(90, 160, 255)}, {text = "Limited", color = Color(255, 125, 155)} }, rightText = "12,000 kr", onClick = function() chat.AddText(Color(0,255,0), "[libNyx] Row clicked!") end }) -- Simple row without gradient list:AddRow({ title = "Standard Package", labels = {{text = "Available", color = Color(120, 220, 160)}}, rightText = "Free", gradient = false, -- Disable gradient background onClick = function() print("Standard package selected") end }) -- Row with multiple label chips list:AddRow({ title = "Special Offer", icon = Material("icon16/house.png"), labels = { {text = "Discount", color = Color(120, 220, 160)}, {text = "Limited", color = Color(255, 125, 155)}, {text = "-15%", color = Color(255, 200, 120)}, {text = "Today", color = Color(120, 200, 255)} }, rightText = "8,500 kr" }) -- Features: -- - Smooth scroll overlay -- - Gradient left accent (per row) -- - Icon + title + labels + right text -- - Ripple effects on click -- - Glass panel styling -- - Variable row heights ``` -------------------------------- ### Configure UI Scale (Bash) Source: https://github.com/maryblackfild/libnyx/blob/main/README.md Allows manual override of the UI scaling factor. Setting to 0 enables automatic scaling based on screen height. The range for manual scaling is from 0.50 to 2.00. ```bash cl_libnyx_ui_scale 0 # 0 = auto, range 0.50 … 2.00 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.